コード例 #1
0
        /// <summary>
        /// AJAX分页
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="html"></param>
        /// <param name="pagedList"></param>
        /// <param name="UpdateTargetId"></param>
        /// <returns></returns>
        public static MvcHtmlString AjaxPager <T>(this HtmlHelper html, PagedList <T> pagedList, string UpdateTargetId, bool isDisplayCompletePage)
        {
            var ui = new PageUI(html.ViewContext.RequestContext.HttpContext.Request.Url.ToString(), UpdateTargetId, pagedList.AddParameters);

            if (!isDisplayCompletePage)
            {
                return(MvcHtmlString.Create(ui.GetPage(pagedList.PageIndex, pagedList.PageSize, pagedList.TotalCount, false)));
            }
            else
            {
                return(MvcHtmlString.Create(ui.GetPage(pagedList.PageIndex, pagedList.PageSize, pagedList.TotalCount)));
            }
        }
コード例 #2
0
        public static MvcHtmlString AjaxPagerAppend <T>(this HtmlHelper html, PageListAppend <T> pagedList, string UpdateTargetId, string ActionName, string ControllerName)
        {
            var localUrl = string.Format(@"{0}://{1}", html.ViewContext.RequestContext.HttpContext.Request.Url.Scheme, html.ViewContext.RequestContext.HttpContext.Request.Url.Authority);
            var url      = string.Format("{0}/{1}/{2}{3}", localUrl, ControllerName, ActionName, html.ViewContext.RequestContext.HttpContext.Request.Url.Query);
            var ui       = new PageUI(url, UpdateTargetId, pagedList.AddParameters);

            return(MvcHtmlString.Create(ui.GetPage(pagedList.PageIndex, pagedList.PageSize, pagedList.TotalCount, false, true)));
        }
コード例 #3
0
        /// <summary>
        /// AJAX分页
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="html"></param>
        /// <param name="pagedList"></param>
        /// <param name="UpdateTargetId"></param>
        /// <param name="ActionName"></param>
        /// <param name="ControllerName"></param>
        /// <returns></returns>
        public static MvcHtmlString AjaxPager <T>(this HtmlHelper html, PagedList <T> pagedList, string UpdateTargetId, string ActionName, string ControllerName, bool isDisplayCompletePage, bool isTop)
        {
            var mvcUrl   = new UrlHelper(html.ViewContext.RequestContext).Action(ActionName, ControllerName); //占岭修改
            var localUrl = string.Format(@"{0}://{1}", html.ViewContext.RequestContext.HttpContext.Request.Url.Scheme, html.ViewContext.RequestContext.HttpContext.Request.Url.Authority);
            var url      = string.Format("{0}{1}{2}", localUrl, mvcUrl, html.ViewContext.RequestContext.HttpContext.Request.Url.Query);
            var ui       = new PageUI(url, UpdateTargetId, pagedList.AddParameters);

            return(MvcHtmlString.Create(ui.GetPage(pagedList.PageIndex, pagedList.PageSize, pagedList.TotalCount, isDisplayCompletePage, false, isTop)));
        }
コード例 #4
0
        /// <summary>
        /// Html分页,router为true表示走MVC路由
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="html"></param>
        /// <param name="pagedList"></param>
        /// <param name="router">路由</param>
        /// <param name="className">CSS类名</param>
        /// <returns></returns>
        public static MvcHtmlString Pager <T>(this HtmlHelper html, PagedList <T> pagedList, bool router, bool isCompleteDisplay, string className)
        {
            if (pagedList == null)
            {
                return(null);
            }
            PageUI ui = new PageUI(html.ViewContext.RequestContext.HttpContext.Request.Url.ToString(), pagedList.AddParameters);

            if (router)
            {
                return(MvcHtmlString.Create(ui.GetPage(pagedList.PageIndex
                                                       , pagedList.PageSize
                                                       , pagedList.TotalCount
                                                       , 0
                                                       , new UrlHelper(html.ViewContext.RequestContext)
                                                       , html.ViewContext.RouteData.Values["action"].ToString()
                                                       , html.ViewContext.RouteData.Values["controller"].ToString(), isCompleteDisplay, false, className)));
            }
            return(MvcHtmlString.Create(ui.GetPage(pagedList.PageIndex, pagedList.PageSize, pagedList.TotalCount, isCompleteDisplay, className)));
        }
コード例 #5
0
        /// <summary>
        /// ajax方法加载微薄式分页,可以在页面定义appendCss来修改分布按钮样式
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="html"></param>
        /// <param name="pagedList"></param>
        /// <param name="UpdateTargetId"></param>
        /// <returns></returns>
        public static MvcHtmlString AjaxPagerAppend <T>(this HtmlHelper html, PageListAppend <T> pagedList, string UpdateTargetId)
        {
            PageUI ui = new PageUI(html.ViewContext.RequestContext.HttpContext.Request.Url.ToString(), UpdateTargetId, pagedList.AddParameters);

            return(MvcHtmlString.Create(ui.GetPage(pagedList.PageIndex, pagedList.PageSize, pagedList.TotalCount, false, true)));
        }
コード例 #6
0
        public static MvcHtmlString PagerAppend <T>(this HtmlHelper html, PageListAppend <T> pagedList)
        {
            PageUI ui = new PageUI(html.ViewContext.RequestContext.HttpContext.Request.Url.ToString(), pagedList.AddParameters);

            return(MvcHtmlString.Create(ui.GetPage(pagedList.PageIndex, pagedList.PageSize, pagedList.TotalCount, 0, new UrlHelper(html.ViewContext.RequestContext), html.ViewContext.RouteData.Values["action"].ToString(), html.ViewContext.RouteData.Values["controller"].ToString(), false, true)));
        }