本文整理汇总了C#中PagerOptions类的典型用法代码示例。如果您正苦于以下问题:C# PagerOptions类的具体用法?C# PagerOptions怎么用?C# PagerOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PagerOptions类属于命名空间,在下文中一共展示了PagerOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PagerBuilder
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;
}
示例2: PagerBuilder
internal PagerBuilder(HtmlHelper helper, string actionName, string controllerName, int totalPageCount, int pageIndex, PagerOptions options, object values)
{
// Set defaults
if (String.IsNullOrEmpty(actionName))
actionName = (string)helper.ViewContext.RouteData.Values["action"];
if (String.IsNullOrEmpty(controllerName))
controllerName = (string)helper.ViewContext.RouteData.Values["controller"];
if (options == null)
options = new PagerOptions();
// Assign to fields
_helper = helper;
_actionName = actionName;
_controllerName = controllerName;
_totalPageCount = totalPageCount;
_pageIndex = pageIndex;
_options = options;
_values = values;
// Calculate start page index
_startPageIndex = pageIndex - (options.MaximumPageNumbers / 2);
if (_startPageIndex + options.MaximumPageNumbers > _totalPageCount)
_startPageIndex = _totalPageCount - options.MaximumPageNumbers;
if (_startPageIndex < 0)
_startPageIndex = 0;
// Calculate end page index
_endPageIndex = _startPageIndex + _options.MaximumPageNumbers;
if (_endPageIndex > _totalPageCount)
_endPageIndex = _totalPageCount;
}
示例3: PagerBuilder
//Ajax pager builder
internal PagerBuilder(AjaxHelper ajaxHelper, int totalPageCount, int pageIndex, PagerOptions pagerOptions,
MvcAjaxOptions ajaxOptions)
{
_ajaxPagingEnabled =true;
if (ajaxHelper == null)
{
throw new ArgumentNullException("ajaxHelper");
}
if (pagerOptions == null)
pagerOptions = new PagerOptions();
_ajax = ajaxHelper;
if (pagerOptions.MaximumPageNumber == 0 || pagerOptions.MaximumPageNumber > totalPageCount)
_totalPageCount = totalPageCount;
else
_totalPageCount = pagerOptions.MaximumPageNumber;
_pageIndex = pageIndex;
_pagerOptions = pagerOptions;
_ajaxOptions = ajaxOptions ?? new MvcAjaxOptions();
// 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;
}
示例4: AjaxPager
public static MvcHtmlString AjaxPager(this HtmlHelper html, IPagedList pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions)
{
if (pagedList == null)
return AjaxPager(html, pagerOptions, null);
return AjaxPager(html, pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, null, null, null, pagerOptions, null, ajaxOptions,
null);
}
示例5: Pager
///<include file='MvcPagerDocs.xml' path='MvcPagerDocs/PagerExtensions/Method[@name="HtmlPager4"]/*'/>
public static HtmlPager Pager(this HtmlHelper helper, IPagedList pagedList, PagerOptions pagerOptions)
{
if (pagedList == null)
{
throw new ArgumentNullException("pagedList");
}
return Pager(helper, pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, pagerOptions);
}
示例6: AjaxPager
public static MvcHtmlString AjaxPager(this HtmlHelper html, IPagedList pagedList, string actionName, string controllerName, PagerOptions pagerOptions, AjaxOptions ajaxOptions)
{
if (pagedList == null)
{
return AjaxPager(html, pagerOptions, null);
}
return html.AjaxPager(pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, actionName, controllerName, null, pagerOptions, ((RouteValueDictionary)null), ajaxOptions, ((IDictionary<string, object>)null));
}
示例7: Pager
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();
}
示例8: HtmlPager
///<include file='MvcPagerDocs.xml' path='MvcPagerDocs/HtmlPager/Constructor[@name="HtmlPager1"]/*'/>
public HtmlPager(HtmlHelper html, int totalItemCount, int pageSize, int pageIndex,PagerOptions pagerOptions)
{
_htmlHelper = html;
_totalItemCount = totalItemCount;
_pageSize = pageSize;
_currentPageIndex = pageIndex;
_pagerOptions = pagerOptions;
}
示例9: Pager
public Pager(HtmlHelper htmlHelper, int pageSize, int currentPage, int totalItemCount)
{
_htmlHelper = htmlHelper;
_pageSize = pageSize;
_currentPage = currentPage;
_totalItemCount = totalItemCount;
PagerOptions = new PagerOptions();
}
示例10: PagerBuilder
/// <summary>
/// Used when PagedList is null
/// </summary>
internal PagerBuilder(HtmlHelper html, PagerOptions pagerOptions, IDictionary<string, object> htmlAttributes)
{
if (pagerOptions == null)
pagerOptions = new PagerOptions();
_html = html;
_pagerOptions = pagerOptions;
_htmlAttributes = htmlAttributes;
}
示例11: AjaxPager
///<include file='MvcPagerDocs.xml' path='MvcPagerDocs/AjaxPager/Constructor[@name="AjaxPager1"]/*'/>
public AjaxPager(AjaxHelper ajax, int totalItemCount, int pageSize, int pageIndex,PagerOptions pagerOptions, MvcAjaxOptions ajaxOptions)
{
_ajaxHelper = ajax;
_totalItemCount = totalItemCount;
_pageSize = pageSize;
_currentPageIndex = pageIndex;
_pagerOptions = pagerOptions;
_ajaxOptions = ajaxOptions;
}
示例12: Options
///<include file='MvcPagerDocs.xml' path='MvcPagerDocs/HtmlPager/Method[@name="Options"]/*'/>
public HtmlPager Options(Action<PagerOptionsBuilder> builder)
{
if (_pagerOptions == null)
{
_pagerOptions = new PagerOptions();
}
builder(new PagerOptionsBuilder(_pagerOptions));
return this;
}
示例13: PagerBuilder
/// <summary>
/// used when PagedList is null
/// </summary>
public PagerBuilder(HtmlHelper html, AjaxHelper ajax, PagerOptions pagerOptions, IDictionary<string, object> htmlAttributes)
{
if (pagerOptions == null)
pagerOptions = new PagerOptions();
_html = html;
_ajax = ajax;
_pagerOptions = pagerOptions;
_htmlAttributes = htmlAttributes;
}
示例14: AjaxPager
public static MvcHtmlString AjaxPager(this HtmlHelper html, int totalItemCount, int pageSize, int pageIndex, string actionName, string controllerName,
string routeName, PagerOptions pagerOptions, RouteValueDictionary routeValues, IDictionary<string, object> htmlAttributes)
{
if (pagerOptions == null)
pagerOptions = new PagerOptions();
var totalPageCount = (int)Math.Ceiling(totalItemCount / (double)pageSize);
var builder = new PagerBuilder(html, actionName, controllerName, totalPageCount, pageIndex, pagerOptions, routeName, routeValues, htmlAttributes);
return builder.RenderPager();
}
示例15: AjaxPager
public static MvcHtmlString AjaxPager(this HtmlHelper html, int totalItemCount, int pageSize, int pageIndex, string actionName, string controllerName,
string routeName, PagerOptions pagerOptions, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)
{
if(pagerOptions == null)
pagerOptions = new PagerOptions();
pagerOptions.UseJqueryAjax = true;
var totalPageCount = (int) Math.Ceiling(totalItemCount/(double) pageSize);
var builder = new PagerBuilder(html, actionName, controllerName, totalPageCount, pageIndex, totalItemCount, pagerOptions,
routeName, new RouteValueDictionary(routeValues), ajaxOptions, new RouteValueDictionary(htmlAttributes));
return builder.RenderPager();
}