Fork me on GitHub

MvcPager帮助文档 - PagerOptions.RouteValues属性

获取或设置用于MvcPager生成分页链接的路由的值。

语法:

public RouteValueDictionary RouteValues {get; set;}

默认值:

当前页面的路由值

用法示例:

@Html.Pager(Model,new PagerOptions{RouteValues=new RouteValueDictionary{{"param1","value1"}}})

此属性也可通过MvcPager的Options扩展方法设置:

HtmlPager:

@Html.Pager(Model).Options(o=>o.SetRouteValues(new RouteValueDictionary{{"param1","value1"}}))

AjaxPager:

@Ajax.Pager(Model).Options(o=>o.SetRouteValues(new RouteValueDictionary{{"param1","value1"}})).AjaxOptions(a=>a.SetUpdateTargetId("target"))

也可通过AddRouteValue(string key, object value)方法添加项:

HtmlPager:

@Html.Pager(Model).Options(o=>o.AddRouteValue("param1","value1"))

AjaxPager:

@Ajax.Pager(Model).Options(o=>o.AddRouteValue("param1","value1")).AjaxOptions(a=>a.SetUpdateTargetId("target"))