Reputation: 103
In a MVC structure using Razor and C#, I am using Mvc.PagedList in order to display pagination for my lists:
Now, this works fine; but as you can see, in my case, I can have a lot of pages to display. The client has asked me to give him an option in order to jump to a specific page. I have seen some websites where this is done through the use of the "..." button; but here, it does nothing.
My questions, therefore, are:
Sample code for the PagedListPager:
@Html.PagedListPager((IPagedList)Model, page => Url.Action("Index", new { page, currentFilter = ViewBag.CurrentFilter }), new PagedListRenderOptions { LiElementClasses = new[] { "needsLoading" } })
Thank you in advance for any and all help you can give me.
Upvotes: 2
Views: 1270
Reputation: 829
Just use the page parameter with the specific page, you could create a list with all pagenumbers in your controller and then use this in a dropdownmenu , or anything you can imagine :D
Upvotes: 0
Reputation: 239300
How you implement it is entirely up to you or the client. Either way you mentioned will work; just pick one.
As for going directly to a specific page, you simply pass the page number you want with the URL for the page. Typically, that would look something like:
/my/awesome/paged/list?page=1
Where page
is the name of your action parameter that holds the current page number and 1
would obviously be the page you want to go to.
Upvotes: 1