我正在使用 c# 并使用 PagedList.Mvc 进行 Ajax 调用。我的 cshtml View 中的代码如下:
@Html.PagedListPager(Model.PagedList, page => Url.Action("SearchTable", "JobOffer",
new {
randomParameters = "BANANAS"
page = page
}), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(
new AjaxOptions() {
HttpMethod = "GET",
UpdateTargetId = "tableAndPaginationDiv"
}
)
)
但是,我还想要 PagedListRenderOptions.ClassicPlusFirstAndLast
。我如何实现这一目标?
最佳答案
实际上,试试这个怎么样:
@{
var pLRO = PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(
new AjaxOptions() {
HttpMethod = "GET",
UpdateTargetId = "tableAndPaginationDiv"
}
);
//and now here set all the properties you want
pLRO.DisplayLinkToFirstPage = PagedListDisplayMode.Always;
pLRO.DisplayLinkToLastPage = PagedListDisplayMode.Always;
//you can even style the format
pLRO.LinkToFirstPageFormat = "First";
pLRO.LinkToLastPageFormat = "Last";
}
//the rest of your view
//...
//and when you insert the pager just pass the pLRO variable
@Html.PagedListPager(Model.PagedList, page => Url.Action("SearchTable", "JobOffer",
new {
randomParameters = "BANANAS"
page = page
}), pLRO
)
关于c# - 如何在 PagedList.Mvc 中拥有多个 PagedListRenderOptions?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30214186/