开发者

Generic list custom paging

开发者 https://www.devze.com 2022-12-20 08:05 出处:网络
I am using jquery ajax method in my app and from the web method I am returning a huge generic list.Upon jquery ajax success I am rendering div\'s with the data retruned from the web method.

I am using jquery ajax method in my app and from the web method I am returning a huge generic list.Upon jquery ajax success I am rendering div's with the data retruned from the web method. B'coz the data returned is very huge,I need to paginate the results.Initially I am returning the first 10 records using List.Take(10).Then upon the next pages button clicks I do not understand how to return the next records.

Could开发者_C百科 someone please help?


Use the Skip method to skip records to the appropriate page. For example:

List.Skip(n).Take(10) 

You'll probably need some bounds checking for the size of the list but that's not very difficult.


Why returning huge data and paginate whith js. Its better for performance to get only the data that you have in your grid.

For page1 display 1-10 For page2 display 11-20 etc

The request must contain the page number so SQL the limit you want for each grid page

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号