示例#1
0
        /// <summary>
        /// 生成最终的分页Html代码
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="pagedable"></param>
        /// <param name="pagingTemplatePartialName"></param>
        /// <returns></returns>
        private static MvcHtmlString RenderPager(HtmlHelper htmlHelper, IPagedable pagedable, string pagingTemplatePartialName)
        {
            if (pagedable.PageNumber <= 0)
            {
                pagedable.PageNumber = 1;
            }

            if (pagedable.PageNumber > 0 && pagedable.PageNumber >= pagedable.PageCount)
            {
                pagedable.PageNumber = pagedable.PageCount;
            }

            var templateHtml = htmlHelper.Partial(pagingTemplatePartialName, pagedable);

            if (templateHtml == null)
                throw new ArgumentException(pagingTemplatePartialName);
            return templateHtml;
        }
示例#2
0
 /// <summary>
 /// Pager
 /// </summary>
 /// <param name="helper"></param>
 /// <param name="pagedable"></param>
 /// <param name="pagingTemplatePartialName"></param>
 /// <returns></returns>
 public static MvcHtmlString Pager(this HtmlHelper helper, IPagedable pagedable, string pagingTemplatePartialName)
 {
     return RenderPager(helper, pagedable, pagingTemplatePartialName);
 }
示例#3
0
 /// <summary>
 /// 生成最终的分页Html代码
 /// </summary>
 /// <param name="htmlHelper"></param>
 /// <param name="pagedable"></param>
 /// <returns></returns>
 private static MvcHtmlString RenderPager(HtmlHelper htmlHelper, IPagedable pagedable)
 {
     return RenderPager(htmlHelper, pagedable, "PagingTemplate");
 }
示例#4
0
 /// <summary>
 /// Pager
 /// </summary>
 /// <param name="helper"></param>
 /// <param name="pagedable"></param>
 /// <returns></returns>
 public static MvcHtmlString Pager(this HtmlHelper helper, IPagedable pagedable)
 {
     return RenderPager(helper, pagedable);
 }