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?
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).
精彩评论