效果图:
ASP.NET MVC URL分页控件

1、实体

ASP.NET MVC URL分页控件using System;
ASP.NET MVC URL分页控件
ASP.NET MVC URL分页控件
namespace System.Web.Mvc

2、分页

 


3、调用

html:<%=Html.MvcPager(ViewData["UserRecordTotalRecords"] as MvcPagerModel,
                                    new { StartDate = RequestExtensions.GetStringQueryString("StartDate"),
                                          EndDate = RequestExtensions.GetStringQueryString("EndDate")})%>

cs:

int pageSize = 19;
int pageIndex = MvcPagerExtensions.GetPageIndex;
int totalRecords = 0;

List<UserRecordContract> result = ×××(×××,ref totalRecords);

MvcPagerModel mvcPagerModel = new MvcPagerModel { PageIndex = pageIndex, PageSize = pageSize, TotalRecords = totalRecords };

ViewData["UserRecordTotalRecords"] = mvcPagerModel;

结: 很简单的一个MVC分页,原理就是获取一个列表的总记录数,然后根据页码进行分页。

作者:拽着胃的牛
本文版权归作者和博客园共有,欢迎转载,未经作者同意必须保留此段声明,请在文章页面明显位置给出原文连接。

 

相关文章: