예제 #1
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)));
        }
예제 #2
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)));
        }
예제 #3
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)));
            }
        }
예제 #4
0
        /// <summary>
        /// ajax方式,MVC路由支持的分页
        /// </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 AjaxMvcPager <T>(this HtmlHelper html, PagedList <T> pagedList, string UpdateTargetId, string ActionName, string ControllerName)
        {
            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
                                                   , 0
                                                   , new UrlHelper(html.ViewContext.RequestContext)
                                                   , html.ViewContext.RouteData.Values["action"].ToString()
                                                   , html.ViewContext.RouteData.Values["controller"].ToString(), true, false, null)));
        }
예제 #5
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)));
        }
예제 #6
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)));
        }
예제 #7
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)));
        }