如何在PagedList.Mvc中将页码放在一行?

时间:2014-03-06 15:42:48

标签: html css asp.net-mvc pagedlist

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

Page 1 of 3
    ← Previous
    1
    2
    3
    Next →

如何以这种方式展示:

Page 1 of 3
← Previous 1 2 3 Next →

Index.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>

的style.css

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

如何将页码放在一行?

2 个答案:

答案 0 :(得分:1)

您是否记得在视图中呈现PagedList CSS文件?

@Styles.Render("~/Content/PagedList.css")

答案 1 :(得分:0)

    @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
})