public Pager(HtmlHelper htmlHelper, int pageSize, int currentPage, int totalItemCount)
 {
     this.htmlHelper = htmlHelper;
     this.pageSize = pageSize;
     this.currentPage = currentPage;
     this.totalItemCount = totalItemCount;
     this.pagerOptions = new PagerOptions();
 }
Example #2
0
        /// <summary>
        /// used when PagedList is null
        /// </summary>
        public PagerBuilder(HtmlHelper htmlHelper, AjaxHelper ajaxHelper, PagerOptions pagerOptions, IDictionary<String, object> htmlAttributes)
        {
            if (default(PagerOptions) == pagerOptions) pagerOptions = new PagerOptions();

            _msAjaxPaging = (default(AjaxHelper) != ajaxHelper);
            _htmlHelper = htmlHelper;
            _ajaxHelper = ajaxHelper;
            _pagerOptions = pagerOptions;
            _htmlAttributes = htmlAttributes;
        }
Example #3
0
        public PagerBuilder(HtmlHelper htmlHelper, AjaxHelper ajaxHelper, String actionName, String controllerName, int noOfPages, int pageIndex, PagerOptions pagerOptions, String routeName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary<String, object> htmlAttributes)
        {
            _msAjaxPaging = (default(AjaxHelper) != ajaxHelper);

            if (actionName.IsNullOrEmpty())
            {
                actionName = _msAjaxPaging
                    ? (String) ajaxHelper.ViewContext.RouteData.Values["action"]
                    : (String) htmlHelper.ViewContext.RouteData.Values["action"];
            }
            if (controllerName.IsNullOrEmpty())
            {
                controllerName = _msAjaxPaging
                    ? (String) ajaxHelper.ViewContext.RouteData.Values["controller"]
                    : (String) htmlHelper.ViewContext.RouteData.Values["controller"];
            }

            if (null == pagerOptions) pagerOptions = new PagerOptions();

            _htmlHelper = htmlHelper;
            _ajaxHelper = ajaxHelper;
            _actionName = actionName;
            _controllerName = controllerName;
            _NoOfPages = noOfPages;
            _pageIndex = pageIndex;
            _pagerOptions = pagerOptions;
            _routeName = routeName;
            _routeValues = routeValues;
            _ajaxOptions = ajaxOptions;
            _htmlAttributes = htmlAttributes;

            // start page index
            _startPageIndex = pageIndex - (pagerOptions.NumericPagerItemCount / 2);
            if (_startPageIndex + pagerOptions.NumericPagerItemCount > _NoOfPages)
                _startPageIndex = _NoOfPages + 1 - pagerOptions.NumericPagerItemCount;
            if (_startPageIndex < 1) _startPageIndex = 1;

            // end page index
            _endPageIndex = _startPageIndex + _pagerOptions.NumericPagerItemCount - 1;
            if (_endPageIndex > _NoOfPages) _endPageIndex = _NoOfPages;
        }
Example #4
0
 //Microsoft Ajax pager builder
 public PagerBuilder(AjaxHelper ajaxHelper, String actionName, String controllerName, int noOfPages, int pageIndex, PagerOptions pagerOptions, String routeName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary<String, object> htmlAttributes)
     : this(null, ajaxHelper, actionName, controllerName, noOfPages, pageIndex, pagerOptions, routeName, routeValues, ajaxOptions, htmlAttributes)
 {
 }
 public PagerOptionsBuilder(PagerOptions pagerOptions)
 {
     this.pagerOptions = pagerOptions;
 }
Example #6
0
        public static String Pager(this AjaxHelper ajaxHelper, int noOfPages, int pageIndex, String actionName, String controllerName, String routeName, PagerOptions pagerOptions, Object routeValues, AjaxOptions ajaxOptions, Object htmlAttributes)
        {
            var builder = new PagerBuilder
                          (
                ajaxHelper,
                actionName,
                controllerName,
                noOfPages,
                pageIndex,
                pagerOptions,
                routeName,
                new RouteValueDictionary(routeValues),
                ajaxOptions,
                new RouteValueDictionary(htmlAttributes)
                          );

            return(builder.RenderPager());
        }
Example #7
0
 public static String Pager <T>(this AjaxHelper ajaxHelper, PagedList <T> pagedList, String routeName, RouteValueDictionary routeValues, PagerOptions pagerOptions, AjaxOptions ajaxOptions, IDictionary <String, Object> htmlAttributes)
 {
     return((default(PagedList <T>) == pagedList)
             ? Pager(ajaxHelper, pagerOptions, htmlAttributes)
             : Pager(ajaxHelper, pagedList.NoOfPages, pagedList.PageIndex, null, null, routeName, pagerOptions, routeValues, ajaxOptions, htmlAttributes));
 }
Example #8
0
 public static String Pager <T>(this AjaxHelper ajaxHelper, PagedList <T> pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions, Object htmlAttributes)
 {
     return((default(PagedList <T>) == pagedList)
             ? Pager(ajaxHelper, pagerOptions, new RouteValueDictionary(htmlAttributes))
             : Pager(ajaxHelper, pagedList.NoOfPages, pagedList.PageIndex, null, null, null, pagerOptions, null, ajaxOptions, htmlAttributes));
 }
Example #9
0
 public static String Pager <T>(this AjaxHelper ajaxHelper, PagedList <T> pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions)
 {
     return((default(PagedList <T>) == pagedList)
             ? Pager(ajaxHelper, pagerOptions, null)
             : Pager(ajaxHelper, pagedList.NoOfPages, pagedList.PageIndex, null, null, null, pagerOptions, null, ajaxOptions, null));
 }
Example #10
0
 static String Pager(AjaxHelper ajaxHelper, PagerOptions pagerOptions, IDictionary <String, Object> htmlAttributes)
 {
     return(new PagerBuilder(null, ajaxHelper, pagerOptions, htmlAttributes).RenderPager());
 }
Example #11
0
        public PagerBuilder(HtmlHelper htmlHelper, AjaxHelper ajaxHelper, String actionName, String controllerName, int noOfPages, int pageIndex, PagerOptions pagerOptions, String routeName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary <String, object> htmlAttributes)
        {
            _msAjaxPaging = (default(AjaxHelper) != ajaxHelper);

            if (actionName.IsNullOrEmpty())
            {
                actionName = _msAjaxPaging
                    ? (String)ajaxHelper.ViewContext.RouteData.Values["action"]
                    : (String)htmlHelper.ViewContext.RouteData.Values["action"];
            }
            if (controllerName.IsNullOrEmpty())
            {
                controllerName = _msAjaxPaging
                    ? (String)ajaxHelper.ViewContext.RouteData.Values["controller"]
                    : (String)htmlHelper.ViewContext.RouteData.Values["controller"];
            }

            if (null == pagerOptions)
            {
                pagerOptions = new PagerOptions();
            }

            _htmlHelper     = htmlHelper;
            _ajaxHelper     = ajaxHelper;
            _actionName     = actionName;
            _controllerName = controllerName;
            _NoOfPages      = noOfPages;
            _pageIndex      = pageIndex;
            _pagerOptions   = pagerOptions;
            _routeName      = routeName;
            _routeValues    = routeValues;
            _ajaxOptions    = ajaxOptions;
            _htmlAttributes = htmlAttributes;

            // start page index
            _startPageIndex = pageIndex - (pagerOptions.NumericPagerItemCount / 2);
            if (_startPageIndex + pagerOptions.NumericPagerItemCount > _NoOfPages)
            {
                _startPageIndex = _NoOfPages + 1 - pagerOptions.NumericPagerItemCount;
            }
            if (_startPageIndex < 1)
            {
                _startPageIndex = 1;
            }

            // end page index
            _endPageIndex = _startPageIndex + _pagerOptions.NumericPagerItemCount - 1;
            if (_endPageIndex > _NoOfPages)
            {
                _endPageIndex = _NoOfPages;
            }
        }
Example #12
0
 //Microsoft Ajax pager builder
 public PagerBuilder(AjaxHelper ajaxHelper, String actionName, String controllerName, int noOfPages, int pageIndex, PagerOptions pagerOptions, String routeName, RouteValueDictionary routeValues, AjaxOptions ajaxOptions, IDictionary <String, object> htmlAttributes)
     : this(null, ajaxHelper, actionName, controllerName, noOfPages, pageIndex, pagerOptions, routeName, routeValues, ajaxOptions, htmlAttributes)
 {
 }