Skip to content Skip to sidebar Skip to footer

Paging By Using Dynamically Created Html Table

I am coding online sales for a website. I have a problem on my main page where I would like to show products. I defined a table with 4 columns, but there are over than a 100 produc

Solution 1:

There are a lot of finished controls that will help you on the way, check this MSDN Article out: Creating a Pager Control for ASP.NET

You could also check out one of the many jQuery Pagers out there, however if you use the jQuery solution all the rows will always be loaded. If you use some pre-built ASP.NET control for it, it will only fetch the number of elements you desire for each page.

Solution 2:

If you are dynamically creating an HTML table (and not using any of the built-in controls provided by ASP.net for presenting tabular data), then do the following:

  1. Add TextBox and Button controls to allow the user to input and control the page number to show
  2. Add logic to display the current page number and total pages, items, etc
  3. Change your data retrieval to use the current page number and total number of items per page to only display the items that you want. Ideally you would also only retrieve the items that you need (rather than retrieving the entire dataset and then only showing some of it). There are different ways to do this based on how you are retrieving your data.

Also check out one of the following articles:

Post a Comment for "Paging By Using Dynamically Created Html Table"