Need to create next button
-
Hi everyone, I am new to this community and C# in general, (a PHP guy) but I am hoping I can get some help here. I am trying to have a page display 20 products then, a next button for the other 20 and so on. Below is the code of what I am trying to achieve. (link to image image_new_button.png - Google Drive[^] ) Thanks for your help in advance. Best regards
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="winners.aspx.cs" Inherits="FrontPanel.winners" %>
#### Winner List
Product Details
Amount
User Details
<%#Eval("productname") %>
<%#Eval("winamount") %>
<%#Eval("username") %>
-
Hi everyone, I am new to this community and C# in general, (a PHP guy) but I am hoping I can get some help here. I am trying to have a page display 20 products then, a next button for the other 20 and so on. Below is the code of what I am trying to achieve. (link to image image_new_button.png - Google Drive[^] ) Thanks for your help in advance. Best regards
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="winners.aspx.cs" Inherits="FrontPanel.winners" %>
#### Winner List
Product Details
Amount
User Details
<%#Eval("productname") %>
<%#Eval("winamount") %>
<%#Eval("username") %>
I don't see you retrieving any. Usually, the question would be: How do I retrieve the "next" 20? Then, the "previous" 20. And so forth.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
I don't see you retrieving any. Usually, the question would be: How do I retrieve the "next" 20? Then, the "previous" 20. And so forth.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
Hi Gerry, Yes, it does retrieve info already as shown in the screenshot I linked, but it displays it all on a single page. This would cause a lengthy page and users would have to scroll to the bottom which can be never ending. I am looking for a solution to have it display only 20 items per page, with a next and previous button as previously mentioned. Thanks much
-
Hi everyone, I am new to this community and C# in general, (a PHP guy) but I am hoping I can get some help here. I am trying to have a page display 20 products then, a next button for the other 20 and so on. Below is the code of what I am trying to achieve. (link to image image_new_button.png - Google Drive[^] ) Thanks for your help in advance. Best regards
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="winners.aspx.cs" Inherits="FrontPanel.winners" %>
#### Winner List
Product Details
Amount
User Details
<%#Eval("productname") %>
<%#Eval("winamount") %>
<%#Eval("username") %>
The plumbers are here and working in my apratment room so to pass the time I'v fired up my web browser and coming across your question, I'm prompted to provide a few links which might be helpful. One is at StackExchange and in this particular post there's another link which is to C# Corner. Check them out: https://stackoverflow.com/questions/4293805/how-to-show-20-rows-on-datagrid-each-time[^] Example of DataGrid in ASP.NET[^] And to top all this off, there's another link that comes full circle back to CP: Using ROW_NUMBER() to paginate your data with SQL Server 2005 and ASP.NET[^] What I seem to do when I use someone elses code is try anything that remotely resembles what I want to see happen ... but of course the example/sample's got to compile first!. That second C#Corner webpage even shows images of the expected output from the running. Perhaps too old that CP SQLServer suggestion but I've always had good luck fronting data with the various flavors of SQL and there's always a ton of it on SO.
-
Hi Gerry, Yes, it does retrieve info already as shown in the screenshot I linked, but it displays it all on a single page. This would cause a lengthy page and users would have to scroll to the bottom which can be never ending. I am looking for a solution to have it display only 20 items per page, with a next and previous button as previously mentioned. Thanks much
You didn't show the code that queries the database and returns it. I'm going to assume it's a simple query that returns everything in a table. You're basically going to have to completely re-write that code, and the code you posted, so it can track which page the user is on, and take parameters for what to return, like the number of items per page and which page to return. There's plenty of examples on the web for "ASP.NET database paging". All you have to do is search for that.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak