Fork me on GitHub

PagerOptions.MaximumPageIndexItems property

Gets or sets the maximum number of page indices to be displayed within page index dropdownlist, this property value has no effect if page index box is a textbox,

Syntax:

public int MaximumPageIndexItems {get; set;}

Default value:

20

Example:

@Html.Pager(Model,new PagerOptions{MaximumPageIndexItems=10})

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

HtmlPager:

@Html.Pager(Model).Options(o=>o.SetMaximumPageIndexItems(10))

AjaxPager:

@Ajax.Pager(Model).Options(o=>o.SetMaximumPageIndexItems(10)).AjaxOptions(a=>a.SetUpdateTargetId("target"))

Live demo:

@Html.Pager(Model,new PagerOptions{PageIndexBoxId="pageBox1",GoToButtonId="goBtn1",MaximumPageIndexItems=5})
Go to page:<select id="pageBox1"></select><button id="goBtn1">Go</button>
FirstPrev12345678910...NextLast
Go to page:
@Html.Pager(Model).Options(o => o.SetPageIndexBoxId("pageBox2").SetGoToButtonId("goBtn2").SetMaximumPageIndexItems(10))
Go to page:<select id="pageBox2"></select><button id="goBtn2">Go</button>
FirstPrev12345678910...NextLast
Go to page: