Paging using dynamically generated html table
2 answers
There are many out-of-the-box controls to help you with this, check out this MSDN edition: Creating a Pager Control for ASP.NET
You can also check out one of the many jQuery players , however if you are using a jQuery solution, all rows will always be loaded.If you use some kind of pre-installed ASP.NET control for it, it will only retrieve the number of elements you want for each page.
+2
source to share
If you are dynamically creating an HTML table (and are not using any of the built-in controls provided by ASP.net for presenting tabular data), follow these steps:
- Add TextBox and Button controls to allow the user to enter and control the page number to show
- Add logic to display the current page number and general pages, items, etc.
- Modify your data search to use the current page number and total items per page to only display the items you want. Ideally, you should also only fetch the items you need (instead of fetching the entire dataset and then only showing a few of them). There are various ways to do this based on how you retrieve the data.
Also check out one of the following articles:
- Custom Paging in ASP.net 2.0 with Sql Server 2005 - Scott Mitchell
- Efficient Paging Over Large Amount of Data - MSDN, C #
- Building a Pager Control for ASP.NET - Dino Esposito, MSDN
+2
source to share