Fork me on GitHub

MvcPager帮助文档 - PagerOptions.CurrentPagerItemTemplate属性

获取或设置当前页分页元素的html模板。

语法:

public string CurrentPagerItemTemplate {get; set;}

默认值:

null

用法示例:

@Html.Pager(Model,new PagerOptions{CurrentPagerItemTemplate="<span class=\"text-danger\"><strong>{0}</strong></span>"})

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

HtmlPager:

@Html.Pager(Model).Options(o=>o.SetCurrentPagerItemTemplate("<span class=\"text-danger\"><strong>{0}</strong></span>"))

AjaxPager:

@Ajax.Pager(Model).Options(o=>o.SetCurrentPagerItemTemplate("<span class=\"text-danger\"><strong>{0}</strong></span>")).AjaxOptions(a=>a.SetUpdateTargetId("target"))

示例:

@Html.Pager(Model, new PagerOptions { CurrentPagerItemTemplate = "<span class="text-danger"><strong>{0}</strong></span>" })
首页上页12345678910...下页尾页

@Html.Pager(Model).Options(o => o.SetCurrentPageNumberFormatString("【{0}】").SetCurrentPagerItemTemplate("<span class=\"text-danger\"><strong>{0}</strong></span>"))
首页上页【1】2345678910...下页尾页