Fork me on GitHub

MvcPager帮助文档 - PagerOptions.MaximumPageIndexItems属性

获取或设置页索引下拉框中显示的最大页索引条数,该属性仅当页索引框为下拉框时有效,为文本输入框时被忽略。

语法:

public int MaximumPageIndexItems {get; set;}

默认值:

20

用法示例:

@Html.Pager(Model,new PagerOptions{MaximumPageIndexItems=10})

此属性也可通过MvcPager的Options扩展方法设置:

HtmlPager:

@Html.Pager(Model).Options(o=>o.SetMaximumPageIndexItems(10))

AjaxPager:

@Ajax.Pager(Model).Options(o=>o.SetMaximumPageIndexItems(10)).AjaxOptions(a=>a.SetUpdateTargetId("target"))

示例:

@Html.Pager(Model,new PagerOptions{PageIndexBoxId="pageBox1",GoToButtonId="goBtn1",MaximumPageIndexItems=5})
跳转到第<select id="pageBox1"></select>页<button id="goBtn1">跳转</button>
首页上页12345678910...下页尾页
跳转到第
@Html.Pager(Model).Options(o => o.SetPageIndexBoxId("pageBox2").SetGoToButtonId("goBtn2").SetMaximumPageIndexItems(10))
跳转到第<select id="pageBox2"></select>页<button id="goBtn2">跳转</button>
首页上页12345678910...下页尾页
跳转到第