Fork me on GitHub

MvcPager帮助文档 - PagerOptions.CurrentPageNumberFormatString属性

获取或设置当前页索引格式字符串。

语法:

public string CurrentPageNumberFormatString {get; set;}

默认值:

{0}

用法示例:

@Html.Pager(Model,new PagerOptions{CurrentPageNumberFormatString="-{0}-"})

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

HtmlPager:

@Html.Pager(Model).Options(o=>o.SetCurrentPageNumberFormatString("-{0}-"))

AjaxPager:

@Ajax.Pager(Model).Options(o=>o.SetCurrentPageNumberFormatString("-{0}-")).AjaxOptions(a=>a.SetUpdateTargetId("target"))

示例:

@Html.Pager(Model, new PagerOptions { CurrentPageNumberFormatString = "-{0}-" })
首页上页...3435363738-39-40414243...下页尾页

@Html.Pager(Model).Options(o=>o.SetCurrentPageNumberFormatString("【{0}】"))
首页上页...3435363738【39】40414243...下页尾页