Fork me on GitHub

PagerOptions.NumericPagerItemTemplate property

Gets or sets the html template for the numeric pager items.

Remarks:

If CurrentPagerItemTemplate property value is not set, this template will also be applied to the current page pager item.

Syntax:

public string NumericPagerItemTemplate {get; set;}

Default value:

null

Example:

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

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

HtmlPager:

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

AjaxPager:

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

Live demo:

<style type="text/css">
    .navbtns {font-weight: bold;color: green;}
    .navbtns a {color: red;}
</style>
@Html.Pager(Model).Options(o => o.SetNumericPagerItemTemplate("<span class=\"navbtns\">{0}</span>"))
FirstPrev12345678910...NextLast