2

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 !!

Johnny
  • 601
  • 6
  • 18
  • 2
    Are you using https://github.com/troygoode/pagedlist? If you are, see [my answer](http://stackoverflow.com/questions/19870565/pagination-strategy/19870682#19870682) to a similar question. – John H Dec 24 '13 at 18:56
  • 1
    Gotcha ..I'll read and try that. Thanks !! – Johnny Dec 24 '13 at 22:46
  • Use StaticPagedList http://stackoverflow.com/questions/19942395/pagedlist-using-linq-skip-and-take-but-show-paging-using-count-of-results – user3953989 Jan 18 '16 at 00:20

1 Answers1

0

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

Rashedul.Rubel
  • 3,446
  • 25
  • 36