Fork me on GitHub

PagerOptions.PagerItemTemplate property

Gets or sets the html template to be applied to all pager items.

Syntax:

public string PagerItemTemplate {get; set;}

Default value:

null

Example:

@Html.Pager(Model,new PagerOptions{PagerItemTemplate="<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.SetPagerItemTemplate("<span class=\"text-muted\"><strong>{0}</strong></span>"))

AjaxPager:

@Ajax.Pager(Model).Options(o=>o.SetPagerItemTemplate("<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.SetPagerItemTemplate("<span class=\"navbtns\">{0}</span>"))
FirstPrev12345678910...NextLast