Fork me on GitHub

MvcPager帮助文档 - PagerOptions.NumericPagerItemCount属性

获取或设置数字页索引分页按钮数目。

语法:

public int NumericPagerItemCount {get; set;}

默认值:

10

用法示例:

@Html.Pager(Model,new PagerOptions{NumericPagerItemCount=5})

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

HtmlPager:

@Html.Pager(Model).Options(o=>o.SetNumericPagerItemCount(5))

AjaxPager:

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

示例:

@Html.Pager(Model, new PagerOptions {NumericPagerItemCount = 5})
首页上页...45678...下页尾页

@Html.Pager(Model).Options(o => o.SetNumericPagerItemCount(8))
首页上页...23456789...下页尾页