/// <summary> /// web 分页HTML /// </summary> /// <param name="pageNumber">当前页码</param> /// <param name="totalPages">总页数</param> /// <param name="numberPagesToDisplay">显示几页</param> /// <param name="cssClassForCurrentPage">显示当前页的css(current)</param> /// <param name="cssClassForPage">显示费当前页的css</param> /// <param name="showFirstAndLastPage">是否显示第一页和最后一页</param> /// <param name="language">语言</param> /// <param name="urlBuilder">url规则</param> /// <returns></returns> public static string Build(int pageNumber, int totalPages, int numberPagesToDisplay, string cssClassForCurrentPage, string cssClassForPage, bool showFirstAndLastPage, PagerLanguage language, Func <int, UrlArguments> urlBuilder) { Pager pager = new Pager(pageNumber, totalPages, new PagerSettings(numberPagesToDisplay, cssClassForCurrentPage, cssClassForPage, showFirstAndLastPage, language)); return(pager.ToHtml((ndx) => urlBuilder.Invoke(ndx).ToString())); }
/// <summary> /// web 分页HTML /// </summary> /// <typeparam name="T"></typeparam> /// <param name="model"></param> /// <param name="numberPagesToDisplay"></param> /// <param name="showFirstAndLastPage">是否显示第一页和最后一页</param> /// <param name="language"></param> /// <param name="urlBuilder">url规则</param> /// <returns></returns> public static string BuildPageHtml <T>(this PagedModel <T> model, int numberPagesToDisplay, bool showFirstAndLastPage, PagerLanguage language, Func <int, string> urlBuilder) { if (model == null) { return(string.Empty); } return(Build(model.PageNumber, model.TotalPages, numberPagesToDisplay, showFirstAndLastPage, language, urlBuilder)); }
/// <summary> /// web 分页HTML /// </summary> /// <param name="pageNumber">当前页码</param> /// <param name="totalPages">总页数</param> /// <param name="numberPagesToDisplay">显示几页</param> /// <param name="showFirstAndLastPage">是否显示第一页和最后一页</param> /// <param name="language">语言</param> /// <param name="urlBuilder">url规则</param> /// <returns></returns> public static string Build(int pageNumber, int totalPages, int numberPagesToDisplay, bool showFirstAndLastPage, PagerLanguage language, Func <int, UrlArguments> urlBuilder) { return(Build(pageNumber, totalPages, numberPagesToDisplay, "current", string.Empty, showFirstAndLastPage, language, urlBuilder)); }