public static MvcHtmlString ListPageSize(this HtmlHelper helper, string actionName, string controllerName, object htmlAttributes) { var viewData = (IListViewData)helper.ViewData.Model; IPagedListState state = viewData.Items; var routeValues = new RouteValueDictionary(viewData.Specification); return(PageSize(state, new RouteValueDictionary(htmlAttributes), (linkText, pageIndex, pageSize) => { return ActionLink(helper, linkText, actionName ?? "List", controllerName, routeValues, pageIndex, pageSize); })); }
public static MvcHtmlString Pager(IPagedListState state, IDictionary <string, object> htmlAttributes, Func <string, int, int, string> getPageLink) { var settings = state.Settings; if (!settings.AlwaysVisible) { if (state.PageCount == 1) { return(MvcHtmlString.Empty); } } return(Pager(state.PageIndex, state.PageSize != settings.DefaultItemsPerPage ? state.PageSize : 0, settings.PageCount, state.PageCount, htmlAttributes, getPageLink)); }
public static MvcHtmlString PageSize(IPagedListState state, IDictionary <string, object> htmlAttributes, Func <string, int, int, string> getPageLink) { var settings = state.Settings; var pageSize = settings.PageSizes; if (!settings.AlwaysVisible) { pageSize = settings.AdjustPageSize(state.TotalItemCount); if (pageSize.Length == 0) { return(MvcHtmlString.Empty); } } return(PageSize(state.PageSize, pageSize, htmlAttributes, getPageLink)); }