我正在使用TroyGoode制作的PagedList:https://github.com/TroyGoode/PagedList/
但我希望它呈现比当前更多的输出。
默认输出为:www.mypage.com/mytopic?page=3
但是我想生产的是:www.mypage.com/mytopic/3/
我当前使用的代码摘自以下示例:
http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application
@Html.PagedListPager( Model, page => Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter }) )
有谁知道我如何获得此组件以将另一种形式的页面调度添加到我的网址?
最佳答案
除了cem的答案:您可能还想添加sortOrder
和currentFilter
参数:
routes.MapRoute(
"mytopic",
"mytopic/{page}/{sortOrder}/{currentFilter}",
new
{
controller = "Home",
action = "Index",
page = 1,
sortOrder = UrlParameter.Optional,
currentFilter = UrlParameter.Optional
}
);