Пример #1
0
 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)
 {
 }
Пример #2
0
 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)
 {
     this._ajaxPagingEnabled = (ajax != null);
     if (pagerOptions == null)
     {
         pagerOptions = new PagerOptions();
     }
     this._html           = html;
     this._ajax           = ajax;
     this._actionName     = actionName;
     this._controllerName = controllerName;
     if (pagerOptions.MaxPageIndex == 0 || pagerOptions.MaxPageIndex > totalPageCount)
     {
         this._totalPageCount = totalPageCount;
     }
     else
     {
         this._totalPageCount = pagerOptions.MaxPageIndex;
     }
     this._pageIndex      = pageIndex;
     this._pagerOptions   = pagerOptions;
     this._routeName      = routeName;
     this._routeValues    = routeValues;
     this._ajaxOptions    = ajaxOptions;
     this._htmlAttributes = htmlAttributes;
     this._startPageIndex = pageIndex - pagerOptions.NumericPagerItemCount / 2;
     if (this._startPageIndex + pagerOptions.NumericPagerItemCount > this._totalPageCount)
     {
         this._startPageIndex = this._totalPageCount + 1 - pagerOptions.NumericPagerItemCount;
     }
     if (this._startPageIndex < 1)
     {
         this._startPageIndex = 1;
     }
     this._endPageIndex = this._startPageIndex + this._pagerOptions.NumericPagerItemCount - 1;
     if (this._endPageIndex > this._totalPageCount)
     {
         this._endPageIndex = this._totalPageCount;
     }
 }