Reputation: 1192
Hi all i wonder if someone can give me some help. I've written some sql that will perform some server side pagination, this is working fine when i'm executing it manually. However i want to build a user interface and obviously allow the user to page through each page of data. I'm quite new to mvc and i'm struggling on how to come up with a solution to execute a stored procedure passing in the pageSize and pageNumber. I've worked out how to execute the stored procedure, but struggling on how to do the pagination part. Any pointers?
Upvotes: 1
Views: 1353
Reputation: 4624
Check out this implementation of paging in MVC http://blogs.taiga.nl/martijn/2008/08/27/paging-with-aspnet-mvc/ It comes with a demo project
With this you just use this helper in the View and it takes care of all the dirty work:
<%= Html.Pager(ViewData.Model.PageSize, ViewData.Model.PageNumber, ViewData.Model.TotalItemCount, new { categoryname = ViewData["CategoryDisplayName"] } )%>
Upvotes: 1