Fork me on GitHub

PagerOptions.CurrentPagerItemTemplate property

Gets or sets the html template to be applied to the current page pager item.

Syntax:

public string CurrentPagerItemTemplate {get; set;}

Default value:

null

Example:

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

This property value can also be set via the Options method as bellow:

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"))

Live demo:

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

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