EDIT: This question has been made redundant by this question as much of the code changed from using a repository to using just the controller: (Homework) MVC Pagination Help
问题:
回答1:
Cameron,
I can point you to an example that I created a wee while back for someone here on SO (using an IPagedList interface). it works as a htmlhelper but may be more featured than you're after. it follows the pattern here on SO for paging, i.e.:
anyway, you can pick it up from here and have a poke around with it:
http://www.gatehousemusic.com/downloads/MvcApplication2.zip
also, my alternative solution based on your object structure and simplified paging needs:
http://www.gatehousemusic.com/downloads/PagingSimple.zip
回答2:
May I suggest the following article: Displaying a Paged Grid of Data in ASP.NET MVC. It walks through displaying a paged grid of data and building a paging interface in detail.
回答3:
you could also try this approach (a button that shows more results, instead of going to the next page)
http://demo.aspnetawesome.com/AjaxListDemo
or a simple pager http://demo.aspnetawesome.com/PagerDemo