Ejemplo n.º 1
0
        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);
            }));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }