PagedList MVC Paging Helper on an already paged dataset (Skip and Take)

1.8k Views Asked by At

I'm trying the PagedList MVC package and it seems that it expects us to load the entire table at the controller level so that it can do the paging magic at the Razor level.

My code already does the paging at the stored procedure level, so I only receive the right amount of records. Still I would like to use the PagedList paging part but don't know how since it only shows "1" page (cause that's what my stored procedure returns).

I;ve seen another post where they ask the same thing but never got an answer.

This is my current code:

 @Html.PagedListPager(Model, page => Url.Action("Index",
     new { page, sortOrder = ViewBag.CurrentSort, 
           currentFilter = ViewBag.CurrentFilter }), 
           PagedListRenderOptions.OnlyShowFivePagesAtATime)

Is there a way to be able to use the Paging part without having to load the entire data model. I would imagine the Paging helper just needs to know the total records and the page size in order to display correctly the LINKS 1,2,3,4,5 prev and next.

BTW, Merry XMass all !!

1

There are 1 best solutions below

0
On

I don't think you can use paging part without the model because it is the model from where you will get data for paging. For more info click here