Click here to Skip to main content
15,905,682 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i used div instead of gridview in my asp.net page to display list of values. i want to set pagination for that page. How can i set pagination ?
Posted

You may be better off using a repeater control with the built in paging capability instead of a div. If you are using a div and manually populating data into it then you will also need to manually handle the paging requirements.
 
Share this answer
 
Comments
Aswathi Narayan 28-Jun-11 8:23am    
Thank u 4 ur reply... may i know how to add paging requirments manually..?
fjdiewornncalwe 28-Jun-11 10:26am    
If you are trying to page manually you will need to manage a few things in your session. I would advise against it personally, as the repeater method would be my first choice, but if you need to you will need to maintain the paging state entirely on your own. You will need to know the current page number that the user wishes to view and you will have to figure out what the starting record to be viewed is. Then you will need to retrieve the data at that starting point(from db or cache) and away you go. It sounds reasonably simple, but you'll find that recreating the wheel on stuff like this is far more problematic and will cause more grief down the road. That is why highly experienced developers leverage existing functionality even if the setup sometimes takes a little longer upfront. The end result will come more quickly and will usually be more stable.
Can I know what is the rational behind using DIV instead of any data control. If you can use any data control (GridView, Repeater) you can get the flexibility of those functionalities easily.

If you still wanted to use DIV, you need to programatically hold values and show the next page records as per.

You can check the following page, it is done with GridView but you can easily convert it to DIV also.

http://www.dotnettwitter.com/2011/05/database-pagination-in-gridview-using_08.html[^]

http://www.dotnettwitter.com/2011/05/database-pagination-in-gridview-using.html[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900