/// <summary> /// 分页方法 /// </summary> /// <param name="html"></param> /// <param name="routeData">当前路由数据</param> /// <param name="index">页码</param> /// <param name="size">每页显示记录数</param> /// <param name="totalPage">总页数</param> /// <param name="paramObj">Url上的附加数据</param> /// <returns></returns> public static MvcHtmlString ToPagerHtml(this HtmlHelper html, RouteData routeData, int index, int size, int totalPage, object paramObj = null) { var pager = new MFPagerSplit(routeData, totalPage, pageIndex: index, pageSize: size, paramObj: paramObj); pager.Area = routeData.DataTokens["area"].ObjectToString(); pager.Action = routeData.Values["action"].ObjectToString(); pager.Controller = routeData.Values["controller"].ObjectToString(); return(html.ToPagerHtml(pager)); }
/// <summary> /// 分页方法 /// </summary> /// <param name="html"></param> /// <param name="mmcoyPager">分页对象</param> /// <returns></returns> public static MvcHtmlString ToPagerHtml(this HtmlHelper html, MFPagerSplit mmcoyPager) { if (!mmcoyPager.IsNullOrEmpty()) { return(new MvcHtmlString(mmcoyPager.PagerSplitString)); } else { throw new ArgumentNullException("分页对象为空!"); } }
/// <summary> /// 分页方法 /// </summary> /// <param name="html"></param> /// <param name="mmcoyPager">分页对象</param> /// <param name="routeData">路由数据</param> /// <returns></returns> public static MvcHtmlString ToPagerHtml(this HtmlHelper html, MFPagerSplit mmcoyPager, RouteData routeData) { if (!mmcoyPager.IsNullOrEmpty()) { mmcoyPager.Area = routeData.DataTokens["area"].ObjectToString(); return(new MvcHtmlString(mmcoyPager.PagerSplitString)); } else { throw new ArgumentNullException("分页对象为空!"); } }
/// <summary> /// 分页方法 /// </summary> /// <param name="html"></param> /// <param name="page">当前页码</param> /// <param name="pageSize">每页显示记录数</param> /// <param name="totalPage">总页数</param> /// <param name="action">动作名称</param> /// <param name="controller">控制器名称</param> /// <returns></returns> public static MvcHtmlString ToPagerHtml(this HtmlHelper html, int pageIndex, int pageSize, int totalPage, string action, string controller, object paramObj = null) { var mmcoyPager = new MFPagerSplit(); mmcoyPager.TotalPage = totalPage; mmcoyPager.PageSize = pageSize; mmcoyPager.PageIndex = pageIndex; mmcoyPager.Action = action; mmcoyPager.Controller = controller; mmcoyPager.PageIndexName = "page"; mmcoyPager.PageSizeName = "pageSize"; mmcoyPager.ParamObj = paramObj; return(new MvcHtmlString(mmcoyPager.PagerSplitString)); }