Flame_Phoenix Flame_Phoenix - 2 months ago 44
C# Question

How to have multiple PagedListRenderOptions in PagedList.Mvc?

I am working with c# and I am making an Ajax call using PagedList.Mvc. The code in my cshtml view is the following:

@Html.PagedListPager(Model.PagedList, page => Url.Action("SearchTable", "JobOffer",
new {
randomParameters = "BANANAS"
page = page
}), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(
new AjaxOptions() {
HttpMethod = "GET",
UpdateTargetId = "tableAndPaginationDiv"
}
)
)


However, I also want to have
PagedListRenderOptions.ClassicPlusFirstAndLast
. How do I achieve this?

Answer

At the time of writing of this answer, having more than one PagedListRenderOptionsis not possible. After checking the documentation, I realized that if you want something like that, the only way is to create a custom option yourself, greatly increasing the complexity of the solution:

Comments