tags:

views:

53

answers:

3

I need to load data in the gridview dynamically. That is when the user clicks the page number 2 then those records only has to be displayed.. I made a stored proc to return only those records whose page number is sent.. It will also return me the number of records too.. Now i want to create a placeholder which will create the page number buttons dynamically based on the number of records. Could anyone help me with the placeholder code.. ??

+1  A: 

You need to use ObjectDataSource for custom paging in GridView.

Check these articles:

http://aspnet.4guysfromrolla.com/articles/031506-1.aspx

Ramesh S
A: 

If you love AJAX, give this a try: http://dotnetslackers.com/articles/ajax/ASPNETAjaxGridAndPager.aspx

Quote from the page:

Paging

When working with large tables we often required to use paging. Although the DataGrid/GridView has built-in support for paging they are pretty much useless. Most developers often refuse to use the built-in functionality and use their own custom logic which usually takes a start index, page size and other additional parameters and in turn returns only the paged records with the total number of records.

There are enough codes on the page to help you start the balll rolling.

o.k.w
+1  A: 

Found this to be useful

http://www.codeproject.com/KB/custom-controls/ASPNETPagerControl.aspx

Sumeru Suresh