Paging using dynamically generated html table

I am coding online sales for a website. I have a problem on my homepage where I would like to display products. I have defined a table with 4 columns but there are over 100 products and I need paging for that.

How can I implement paging with 20 products per page?

0


source to share


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


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:

+2


source







All Articles