Fork me on GitHub

PagerOptions.OnPageIndexError property

Gets or sets the Javascript function to call when page index errors occured.

Syntax:

public string OnPageIndexError {get; set;}

Default value:

null

Example:

@Html.Pager(Model,new PagerOptions{OnPageIndexError="alert('Error:'+err)"})

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

HtmlPager:

@Html.Pager(Model).Options(o=>o.SetOnPageIndexError("alert('Error:'+err)"))

AjaxPager:

@Ajax.Pager(Model).Options(o=>o.SetOnPageIndexError("alert('Error:'+err)")).AjaxOptions(a=>a.SetUpdateTargetId("target"))

Live demo:

See Page index error handling>>