最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
ASP.NET MVC分页问题解决方法
时间:2022-06-25 08:48:42 编辑:袖梨 来源:一聚教程网
在使用Ajax.Pager进行分页的时候需要注意一下几个方面:
1、一定要引入jquery.unobtrusive-ajax.min.js这个js;
2、一定要在页面中使用注册分页器,注册方法:@{Html.RegisterMvcPagerScriptResource();};
具体的使用方法示例:
代码如下 | 复制代码 |
@{ PagerConfig pagerConfig = new PagerConfig("pageIndex", "pageIndexBox", "goToBtn"); PagerOptions options = pagerConfig.GetPagerOption(); } @Ajax.Pager(Model, options).AjaxOptions(a => a.SetUpdateTargetId("articles").SetHttpMethod("Post").SetDataFormId("searchView"))
|
其中Model是IpagedList对象,获取PagerOptions的方法如下:
代码如下 | 复制代码 |
/// /// 翻页配置项 /// /// publicPagerOptions GetPagerOption() { PagerOptions options =newPagerOptions { AutoHide =false, FirstPageText ="首页", LastPageText ="尾页", NextPageText ="下一页", PrevPageText ="上一页", PageIndexParameterName =this._pageIndexParaName, ContainerTagName ="ul", CssClass ="pagination", CurrentPagerItemTemplate =" DisabledPagerItemTemplate =" PagerItemTemplate =" PageIndexBoxId =this._pageIndexBoxId, GoToButtonId =this._goToButtonId, NumericPagerItemCount = 5 };
returnoptions; } |
相关文章
- 阴阳师SSR孔雀明王强度介绍 05-20
- 明日方舟CW 05-20
- bitkeep官网下载app 05-20
- Ordi币安卓版官方登录版 05-20
- 《金铲铲之战》怒翼龙阵容装备搭配 05-20
- 欧易trust钱包安卓版2024 05-20