internal PagerBuilder(HtmlHelper html, AjaxHelper ajax, string actionName, string controllerName,
     int totalPageCount, int pageIndex, PagerOptions pagerOptions, string routeName, RouteValueDictionary routeValues,
     MvcAjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
 {
     _ajaxPagingEnabled = (ajax != null);
     if (pagerOptions == null)
         pagerOptions = new PagerOptions();
     _html = html;
     _ajax = ajax;
     _actionName = actionName;
     _controllerName = controllerName;
     if (pagerOptions.MaxPageIndex == 0 || pagerOptions.MaxPageIndex > totalPageCount)
         _totalPageCount = totalPageCount;
     else
         _totalPageCount = pagerOptions.MaxPageIndex;
     _pageIndex = pageIndex;
     _pagerOptions = pagerOptions;
     _routeName = routeName;
     _routeValues = routeValues;
     _ajaxOptions = ajaxOptions;
     _htmlAttributes = htmlAttributes;
     // start page index
     _startPageIndex = pageIndex - (pagerOptions.NumericPagerItemCount / 2);
     if (_startPageIndex + pagerOptions.NumericPagerItemCount > _totalPageCount)
         _startPageIndex = _totalPageCount + 1 - pagerOptions.NumericPagerItemCount;
     if (_startPageIndex < 1)
         _startPageIndex = 1;
     // end page index
     _endPageIndex = _startPageIndex + _pagerOptions.NumericPagerItemCount - 1;
     if (_endPageIndex > _totalPageCount)
         _endPageIndex = _totalPageCount;
 }
 //Ajax pager builder
 internal PagerBuilder(AjaxHelper helper, string actionName, string controllerName, int totalPageCount,
     int pageIndex, PagerOptions pagerOptions, string routeName, RouteValueDictionary routeValues,
     MvcAjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
     : this(null, helper, actionName,
         controllerName, totalPageCount, pageIndex, pagerOptions, routeName, routeValues, ajaxOptions, htmlAttributes) { }
 public static MvcHtmlString Pager(this AjaxHelper ajax, IPagedList pagedList, string routeName, RouteValueDictionary routeValues,
     PagerOptions pagerOptions, MvcAjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
 {
     if (pagedList == null)
         return Pager(ajax, pagerOptions, htmlAttributes);
     return Pager(ajax, pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, null, null, routeName, pagerOptions, routeValues, ajaxOptions, htmlAttributes);
 }
 public static MvcHtmlString Pager(this AjaxHelper ajax, IPagedList pagedList, PagerOptions pagerOptions, MvcAjaxOptions ajaxOptions, object htmlAttributes)
 {
     if (pagedList == null)
         return Pager(ajax, pagerOptions, new RouteValueDictionary(htmlAttributes));
     return Pager(ajax, pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, null, null, null, pagerOptions, null, ajaxOptions, htmlAttributes);
 }
 public static MvcHtmlString Pager(this AjaxHelper ajax, IPagedList pagedList, PagerOptions pagerOptions, MvcAjaxOptions ajaxOptions)
 {
     return pagedList == null ? Pager(ajax, pagerOptions, null) : Pager(ajax, pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex,
         null, null, null, pagerOptions, null, ajaxOptions, null);
 }
 public static MvcHtmlString Pager(this AjaxHelper ajax, int totalItemCount, int pageSize, int pageIndex, string actionName, string controllerName,
     string routeName, PagerOptions pagerOptions, RouteValueDictionary routeValues, MvcAjaxOptions ajaxOptions, IDictionary<string, object> htmlAttributes)
 {
     var totalPageCount = (int)Math.Ceiling(totalItemCount / (double)pageSize);
     var builder = new PagerBuilder(ajax, actionName, controllerName, totalPageCount, pageIndex, pagerOptions,
                                    routeName, routeValues, ajaxOptions, htmlAttributes);
     return builder.RenderPager();
 }