1

我正在使用 PagedList.Mvc 版本 3.18。现在有关页面的信息显示如下:

Page 1 of 3
    ← Previous
    1
    2
    3
    Next →

如何使它以这种方式显示:

Page 1 of 3
← Previous 1 2 3 Next →

索引.cshtml

<div id="pager">
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
@Html.PagedListPager(Model, page => Url.Action("Index", new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))
</div>

样式.css

    #pager {
    display:inline-block;
    width:100%;
}

如何将页码放在一行中?

4

2 回答 2

1

你还记得在视图中渲染 PagedList CSS 文件吗?

@Styles.Render("~/Content/PagedList.css")
于 2014-10-10T10:26:51.807 回答
1
    @Html.PagedListPager(Model, page => Url.Action("IndexMsgUser", new { page, currentFilter = ViewBag.CurrentFilter }),
new PagedListRenderOptions()
{
           DisplayLinkToFirstPage = PagedListDisplayMode.Always,
           DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
           DisplayLinkToLastPage = PagedListDisplayMode.Always,
           DisplayLinkToNextPage = PagedListDisplayMode.Always,
           MaximumPageNumbersToDisplay = 3, // number of pages in line
           DisplayEllipsesWhenNotShowingAllPageNumbers = false
})
于 2017-09-10T16:55:41.610 回答