Fork me on GitHub

PagerOptions.CurrentPageNumberFormatString property

Gets or sets the format string for the current page number.

Syntax:

public string CurrentPageNumberFormatString {get; set;}

Default value:

{0}

Example:

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

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

HtmlPager:

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

AjaxPager:

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

Live demo:

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

@Html.Pager(Model).Options(o=>o.SetCurrentPageNumberFormatString("【{0}】"))
FirstPrev【1】2345678910...NextLast