3

I have a webform which uses a gridview control to show result of a search operation.

I wanna to take advantage of using pagination in the webform. But as you all know, gridview pagination is a client-side pagination and it transfers all records have been selected to the client. What I mean by client-side pagination is the client (page) shows records page by page but every time the user clicks on a page link to navigate through records, all the records are selected from Data Source.

How can I use gridView with datapager in order to have a server side pagination? Or any other solution to get records page by page by configuring our query?

odiseh
  • 25,407
  • 33
  • 108
  • 151
  • I think you need to re-define your `client-side` and `server-side` definitions, otherwise you'll have a much harder time discussing problems related to them. Having said that, check out jqGrid: http://trirand.com/blog/jqgrid/jqgrid.html – Nick Craver Feb 20 '10 at 13:06

1 Answers1

5

I think you're wrong: GridView paging is server-side. See this MSDN article for details: http://msdn.microsoft.com/en-us/library/aa479347.aspx

Update: Now I see what you mean. If you don't want to select all records on every request, then "Custom Paging" is probably what you are looking for. See here for a tutorial: https://web.archive.org/web/20211020140032/https://www.4guysfromrolla.com/articles/031506-1.aspx (BTW: this site has lots of great tutorials, e.g. about data binding).

M4N
  • 94,805
  • 45
  • 217
  • 260
  • @Martin, Oh what I mean for server-side is how to configure a query in order to select records «page by page» from Data Source. – odiseh Feb 20 '10 at 11:10
  • I would add that if you use PetaPoco, the hard part of creating an object that supports custom paging is done for you. All that is left is customizing the `ObjectDataSource`. – FarFigNewton Oct 25 '12 at 14:12
  • Server side pagination usually have some characteristic: 1. Count data filtered 2. IF using EF, usually using skip and take. That is similar using limit i.e 1000.000 data get top 100 only in a page. That link is not best practice of server side pagination, and not answering this problem. – toha Jul 20 '23 at 13:04