本文整理汇总了C#中PagerItem类的典型用法代码示例。如果您正苦于以下问题:C# PagerItem类的具体用法?C# PagerItem怎么用?C# PagerItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PagerItem类属于命名空间,在下文中一共展示了PagerItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddFirst
private void AddFirst(ICollection<PagerItem> results)
{
var item = new PagerItem(_pagerOptions.FirstPageText, 1, _pageIndex == 1, PagerItemType.FirstPage);
//Add pager item when PagerItem is not disabled or PagerItem is disabled but PagerOptions.ShowDisabledPagerItems is true
if (!item.Disabled || (item.Disabled && _pagerOptions.ShowDisabledPagerItems))
results.Add(item);
}
开发者ID:wlclass,项目名称:MvcPager,代码行数:7,代码来源:PagerBuilder.cs
示例2: AddFirst
private void AddFirst(ICollection<PagerItem> results)
{
PagerItem item = new PagerItem(_pagerOptions.FirstPageText, 1, _pagedList.CurrentPageIndex == 1, PagerItemType.FirstPage);
if (!item.Disabled || (item.Disabled && _pagerOptions.ShowDisabledPagerItems))
results.Add(item);
}
开发者ID:Godoy,项目名称:CMS,代码行数:7,代码来源:PagerBuilder.cs
示例3: GeneratePagerElement
private MvcHtmlString GeneratePagerElement(PagerItem item)
{
//pager item link
string url = GenerateUrl(item.PageIndex);
if (item.Disabled) //first,last,next or previous page
return CreateWrappedPagerElement(item, String.Format("<a disabled=\"disabled\" class='ajaxpage'>{0}</a>", item.Text));
return CreateWrappedPagerElement(item,
string.IsNullOrEmpty(url)
? _html.Encode(item.Text)
: String.Format("<a href='{0}' class='ajaxpage'>{1}</a>", url, item.Text));
}
开发者ID:chunlei,项目名称:QrF,代码行数:11,代码来源:PagerBuilder.cs
示例4: GenerateMsAjaxPagerElement
private MvcHtmlString GenerateMsAjaxPagerElement(PagerItem item)
{
if (item.PageIndex == _pageIndex && !item.Disabled) //current page index
return CreateWrappedPagerElement(item, item.Text);
if (item.Disabled)
return CreateWrappedPagerElement(item, string.Format("<a disabled=\"disabled\" class='ajaxpage'>{0}</a>", item.Text));
// return null if current page index less than 1 or large than total page count
if (item.PageIndex < 1 || item.PageIndex > _totalPageCount)
return null;
return CreateWrappedPagerElement(item, GenerateAnchor(item));
}
开发者ID:chunlei,项目名称:QrF,代码行数:13,代码来源:PagerBuilder.cs
示例5: AddPageNumbers
private void AddPageNumbers(ICollection<PagerItem> results)
{
for (var pageIndex = _startPageIndex; pageIndex <= _endPageIndex; pageIndex++)
{
var text = pageIndex.ToString();
if (pageIndex == _pageIndex && !string.IsNullOrEmpty(_pagerOptions.CurrentPageNumberFormatString))
text = String.Format(_pagerOptions.CurrentPageNumberFormatString, text);
else if (!string.IsNullOrEmpty(_pagerOptions.PageNumberFormatString))
text = String.Format(_pagerOptions.PageNumberFormatString, text);
var item = new PagerItem(text, pageIndex, false, PagerItemType.NumericPage);
results.Add(item);
}
}
开发者ID:chunlei,项目名称:QrF,代码行数:13,代码来源:PagerBuilder.cs
示例6: AddLast
private void AddLast(ICollection<PagerItem> results)
{
var item = new PagerItem(_pagerOptions.LastPageText, _totalPageCount, _pageIndex >= _totalPageCount, PagerItemType.LastPage);
if (!item.Disabled || (item.Disabled && _pagerOptions.ShowDisabledPagerItems))
results.Add(item);
}
开发者ID:chunlei,项目名称:QrF,代码行数:6,代码来源:PagerBuilder.cs
示例7: AddPostRange
private void AddPostRange(List<PagerItem> results)
{
if (_endPageIndex < _totalPageCount)
{
var text = "...";
var index = _startPageIndex + _options.MaximumPageNumbers;
if (index > _totalPageCount) index = _totalPageCount;
var url = GenerateUrl(index);
var item = new PagerItem(text, url, false);
results.Add(item);
}
}
开发者ID:listentorick,项目名称:ListenTo,代码行数:12,代码来源:PagerBuilder.cs
示例8: AddNext
private void AddNext(List<PagerItem> results)
{
if (_pageIndex < (_totalPageCount-1))
{
var text = _options.NextText;
var url = GenerateUrl(_pageIndex + 1);
var item = new PagerItem(text, url, false);
results.Add(item);
}
}
开发者ID:listentorick,项目名称:ListenTo,代码行数:10,代码来源:PagerBuilder.cs
示例9: AddPageNumbers
private void AddPageNumbers(List<PagerItem> results)
{
for (var pageIndex = _startPageIndex; pageIndex < _endPageIndex; pageIndex++)
{
var text = (pageIndex + 1).ToString();
var url = GenerateUrl(pageIndex);
var isSelected = pageIndex == _pageIndex;
if (isSelected)
text = String.Format(_options.SelectedPageNumberFormatString, text);
else
text = String.Format(_options.PageNumberFormatString, text);
var item = new PagerItem(text, url, isSelected);
results.Add(item);
}
}
开发者ID:listentorick,项目名称:ListenTo,代码行数:15,代码来源:PagerBuilder.cs
示例10: CreateWrappedPagerElement
private IHtmlString CreateWrappedPagerElement(PagerItem item, string el)
{
if (item.Disabled)
{
if ((!string.IsNullOrEmpty(_pagerOptions.DisabledPagerItemTemplate) ||!string.IsNullOrEmpty(_pagerOptions.NavigationPagerItemTemplate)||
!string.IsNullOrEmpty(_pagerOptions.PagerItemTemplate)))
{
return
MvcHtmlString.Create(
string.Format(
_pagerOptions.DisabledPagerItemTemplate ?? (_pagerOptions.NavigationPagerItemTemplate ??
_pagerOptions.PagerItemTemplate), el));
}
return MvcHtmlString.Create(el);
}
string navStr = el;
switch (item.Type)
{
case PagerItemType.FirstPage:
case PagerItemType.LastPage:
case PagerItemType.NextPage:
case PagerItemType.PrevPage:
if ((!string.IsNullOrEmpty(_pagerOptions.NavigationPagerItemTemplate) ||
!string.IsNullOrEmpty(_pagerOptions.PagerItemTemplate)))
navStr =
string.Format(
_pagerOptions.NavigationPagerItemTemplate ??
_pagerOptions.PagerItemTemplate, el);
break;
case PagerItemType.MorePage:
if ((!string.IsNullOrEmpty(_pagerOptions.MorePagerItemTemplate) ||
!string.IsNullOrEmpty(_pagerOptions.PagerItemTemplate)))
navStr =
string.Format(
_pagerOptions.MorePagerItemTemplate ??
_pagerOptions.PagerItemTemplate, el);
break;
case PagerItemType.NumericPage:
if (item.PageIndex == _pageIndex &&
(!string.IsNullOrEmpty(_pagerOptions.CurrentPagerItemTemplate) ||
!string.IsNullOrEmpty(_pagerOptions.PagerItemTemplate))) //current page
navStr =
string.Format(
_pagerOptions.CurrentPagerItemTemplate ??
_pagerOptions.PagerItemTemplate, el);
else if (!string.IsNullOrEmpty(_pagerOptions.NumericPagerItemTemplate) ||
!string.IsNullOrEmpty(_pagerOptions.PagerItemTemplate))
navStr =
string.Format(
_pagerOptions.NumericPagerItemTemplate ??
_pagerOptions.PagerItemTemplate, el);
break;
}
return MvcHtmlString.Create(navStr);
}
开发者ID:wlclass,项目名称:MvcPager,代码行数:55,代码来源:PagerBuilder.cs
示例11: GenerateAjaxPagerElement
private IHtmlString GenerateAjaxPagerElement(PagerItem item)
{
if (item.Disabled)
return CreateWrappedPagerElement(item,item.Text);
return CreateWrappedPagerElement(item, GenerateAjaxAnchor(item));
}
开发者ID:wlclass,项目名称:MvcPager,代码行数:6,代码来源:PagerBuilder.cs
示例12: GeneratePagerElement
private IHtmlString GeneratePagerElement(PagerItem item)
{
//pager item link
string url = GenerateUrl(item.PageIndex);
if (item.Disabled) //first,last,next or previous page
return CreateWrappedPagerElement(item, item.Text);
return CreateWrappedPagerElement(item,
string.IsNullOrEmpty(url)
? HttpUtility.HtmlEncode(item.Text)
: String.Format("<a href=\"{0}\">{1}</a>", url, item.Text));
}
开发者ID:wlclass,项目名称:MvcPager,代码行数:11,代码来源:PagerBuilder.cs
示例13: AddNext
private void AddNext(ICollection<PagerItem> results)
{
var item = new PagerItem(_pagerOptions.NextPageText, _pagedList.CurrentPageIndex + 1, _pagedList.CurrentPageIndex >= _pagedList.TotalPageCount, PagerItemType.NextPage);
if (!item.Disabled || (item.Disabled && _pagerOptions.ShowDisabledPagerItems))
results.Add(item);
}
开发者ID:Godoy,项目名称:CMS,代码行数:6,代码来源:PagerBuilder.cs
示例14: AddPreRange
private void AddPreRange(List<PagerItem> results)
{
if (_startPageIndex > 0)
{
var text = "...";
var index = _startPageIndex - _options.MaximumPageNumbers;
if (index < 0) index = 0;
var url = GenerateUrl(index);
var item = new PagerItem(text, url, false);
results.Add(item);
}
}
开发者ID:listentorick,项目名称:ListenTo,代码行数:12,代码来源:PagerBuilder.cs
示例15: AddPrevious
private void AddPrevious(ICollection<PagerItem> results)
{
var item = new PagerItem(_pagerOptions.PrevPageText, _pageIndex - 1, _pageIndex == 1, PagerItemType.PrevPage);
if (!item.Disabled || (item.Disabled && _pagerOptions.ShowDisabledPagerItems))
results.Add(item);
}
开发者ID:chunlei,项目名称:QrF,代码行数:6,代码来源:PagerBuilder.cs
示例16: AddPrevious
private void AddPrevious(List<PagerItem> results)
{
if (_pageIndex > 0)
{
var text = _options.PreviousText;
var url = GenerateUrl(_pageIndex - 1);
var item = new PagerItem(text, url, false);
results.Add(item);
}
}
开发者ID:listentorick,项目名称:ListenTo,代码行数:10,代码来源:PagerBuilder.cs
示例17: AddMoreBefore
private void AddMoreBefore(ICollection<PagerItem> results)
{
if (_startPageIndex > 1 && _pagerOptions.ShowMorePagerItems)
{
var index = _startPageIndex - 1;
if (index < 1) index = 1;
var item = new PagerItem(_pagerOptions.MorePageText, index, false, PagerItemType.MorePage);
results.Add(item);
}
}
开发者ID:chunlei,项目名称:QrF,代码行数:10,代码来源:PagerBuilder.cs
示例18: GenerateLink
private string GenerateLink(PagerItem item)
{
return String.Format("<a href='{0}'>{1}</a>", item.Url, _helper.Encode(item.Text));
}
开发者ID:listentorick,项目名称:ListenTo,代码行数:4,代码来源:PagerBuilder.cs
示例19: AddMoreAfter
private void AddMoreAfter(ICollection<PagerItem> results)
{
if (_endPageIndex < _totalPageCount)
{
var index = _startPageIndex + _pagerOptions.NumericPagerItemCount;
if (index > _totalPageCount) { index = _totalPageCount; }
var item = new PagerItem(_pagerOptions.MorePageText, index, false, PagerItemType.MorePage);
results.Add(item);
}
}
开发者ID:chunlei,项目名称:QrF,代码行数:10,代码来源:PagerBuilder.cs
示例20: GenerateAjaxAnchor
private string GenerateAjaxAnchor(PagerItem item)
{
string url = GenerateUrl(item.PageIndex);
if (string.IsNullOrWhiteSpace(url))
return HttpUtility.HtmlEncode(item.Text);
var tag = new TagBuilder("a") { InnerHtml = item.Text };
tag.MergeAttribute("href", url);
tag.MergeAttribute("data-pageindex", item.PageIndex.ToString(CultureInfo.InvariantCulture));
return tag.ToString(TagRenderMode.Normal);
}
开发者ID:jasonoiu,项目名称:OIU.CorporateWebsite,代码行数:10,代码来源:PagerBuilder.cs
注:本文中的PagerItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论