• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IPagedList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IPagedList的典型用法代码示例。如果您正苦于以下问题:C# IPagedList类的具体用法?C# IPagedList怎么用?C# IPagedList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IPagedList类属于命名空间,在下文中一共展示了IPagedList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AjaxPager

 public static MvcHtmlString AjaxPager(this HtmlHelper html, IPagedList pagedList, PagerOptions pagerOptions, AjaxOptions ajaxOptions, object htmlAttributes)
 {
     if (pagedList == null)
         return AjaxPager(html, pagerOptions, new RouteValueDictionary(htmlAttributes));
     return AjaxPager(html, pagedList.TotalItemCount, pagedList.PageSize, pagedList.CurrentPageIndex, null, null, null, pagerOptions, null,
                      ajaxOptions, htmlAttributes);
 }
开发者ID:JPomichael,项目名称:IPOW,代码行数:7,代码来源:PagerHelper.cs


示例2: GalleryViewModel

 public GalleryViewModel(Photoset set, IPagedList<FlickrNet.Photo> collection, int post, string id)
 {
     this.Photoset = set;
     this.Photos = collection;
     this.PostID = post;
     this.PhotosetID = id;
 }
开发者ID:lauraemilyjacobsen,项目名称:HikeBlog,代码行数:7,代码来源:GalleryViewModel.cs


示例3: Pager

 /// <summary>
 /// Generates a digg-like pager - div with page numbers as links, previous and next links(or spans)
 /// </summary>
 /// <param name="htmlHelper">Instance of html helper</param>
 /// <param name="collection">Paged collection to render pager for</param>
 /// <param name="actionName">Action name for links generation (optional: default = null)</param>
 /// <param name="controllerName">Controller name for links generation (optional: default = null)</param>
 /// <param name="pagerHtmlAttributes">Object with html attributes for pager container</param>
 /// <param name="pagerContainer">Pager container (optional: default = "div")</param>
 /// <param name="previousLabel">Caption for previous label (optinoal: default = '« Previous')</param>
 /// <param name="nextLabel">Caption for next label (optional: default = 'Next »')</param>
 /// <param name="innerWindow">How many links are shown around current page (optional: default = 4)</param>
 /// <param name="outerWindow">How many links are shown around the first and the last pages (optional: default = 1)</param>
 /// <param name="separator">String separator between page links or spans (optional: default ' ' - space)</param>
 /// <param name="windowLinks">
 /// When true, 'next', 'previous' and page numbers should be rendered,
 /// when false, only 'next' and 'previous' should be rendered.
 /// Optional: default = true
 /// </param>
 /// <returns>System.Web.Mvc.MvcHtmlString</returns>
 public static MvcHtmlString Pager(
     this HtmlHelper htmlHelper,
     IPagedList collection,
     string actionName = null,
     string controllerName = null,
     object pagerHtmlAttributes = null,
     string pagerContainer = "div",
     string previousLabel = "&larr;",
     string nextLabel = "&rarr;",
     int innerWindow = 4,
     int outerWindow = 1,
     string separator = " ",
     bool windowLinks = true
     )
 {
     IRenderer renderer = new DiggStyleLinkRenderer {
         HtmlHelper = htmlHelper,
         Collection = collection,
         ActionName = actionName,
         ControllerName = controllerName,
         PagerContainer = pagerContainer,
         InnerWindow = innerWindow,
         NextLabel = nextLabel,
         OuterWindow = outerWindow,
         PreviousLabel = previousLabel,
         Separator = separator,
         WindowLinks = windowLinks
     };
     renderer.PagerHtmlAttributes = new RouteValueDictionary(pagerHtmlAttributes);
     return MvcHtmlString.Create(renderer.GenerateHtml());
 }
开发者ID:Valve,项目名称:aspirator,代码行数:51,代码来源:PagerExtensions.cs


示例4: Pager

        /// <summary>
        /// Creates a new instance of the Pager class.
        /// </summary>
        /// <param name="pagination">The IPagination datasource</param>
        /// <param name="context">The view context</param>
        public Pager(IPagedList pagination, ViewContext context)
        {
            _pagination = pagination;
            _viewContext = context;

            _urlBuilder = CreateDefaultUrl;
        }
开发者ID:gowhy,项目名称:LoveBank,代码行数:12,代码来源:Pager.cs


示例5: PagedListGoToPageForm

        ///<summary>
        /// Displays a configurable "Go To Page:" form for instances of PagedList.
        ///</summary>
        ///<param name="html">This method is meant to hook off HtmlHelper as an extension method.</param>
        ///<param name="list">The PagedList to use as the data source.</param>
        ///<param name="formAction">The URL this form should submit the GET request to.</param>
        ///<param name="options">Formatting options.</param>
        ///<returns>Outputs the "Go To Page:" form HTML.</returns>
        public static MvcHtmlString PagedListGoToPageForm(this System.Web.Mvc.HtmlHelper html,
		                                         IPagedList list,
		                                         string formAction,
		                                         GoToFormRenderOptions options)
        {
            var form = new TagBuilder("form");
            form.AddCssClass("PagedList-goToPage");
            form.Attributes.Add("action", formAction);
            form.Attributes.Add("method", "get");

            var fieldset = new TagBuilder("fieldset");

            var label = new TagBuilder("label");
            label.Attributes.Add("for", options.InputFieldName);
            label.SetInnerText(options.LabelFormat);

            var input = new TagBuilder("input");
            input.Attributes.Add("type", options.InputFieldType);
            input.Attributes.Add("name", options.InputFieldName);
            input.Attributes.Add("value", list.PageNumber.ToString());

            var submit = new TagBuilder("input");
            submit.Attributes.Add("type", "submit");
            submit.Attributes.Add("value", options.SubmitButtonFormat);

            fieldset.InnerHtml = label.ToString();
            fieldset.InnerHtml += input.ToString(TagRenderMode.SelfClosing);
            fieldset.InnerHtml += submit.ToString(TagRenderMode.SelfClosing);
            form.InnerHtml = fieldset.ToString();
            return new MvcHtmlString(form.ToString());
        }
开发者ID:scarney81,项目名称:PagedList,代码行数:39,代码来源:HtmlHelper.cs


示例6: SeoPager

        public static MvcHtmlString SeoPager(this HtmlHelper helper, IPagedList pagedList, string pageIndexParameterName = "id", int sectionSize = 20)
        {
            var sb = new StringBuilder();

            int pageCount = pagedList.TotalItemCount / pagedList.PageSize + (pagedList.TotalItemCount % pagedList.PageSize == 0 ? 0 : 1);

            if (pageCount > 1)
            {
                var pages = new List<int>();
                for (int i = 1; i <= pageCount; i++)
                    pages.Add(i);
                var sections = pages.GroupBy(p => (p - 1) / sectionSize);
                var currentSection = sections.Single(s => s.Key == (pagedList.CurrentPageIndex - 1) / sectionSize);
                foreach (var p in currentSection)
                {
                    if (p == pagedList.CurrentPageIndex)
                        sb.AppendFormat("<span>{0}</span>", p);
                    else
                        sb.AppendFormat("<a href=\"{1}\">{0}</a>", p, PrepearRouteUrl(helper, pageIndexParameterName, p));
                }
                if (sections.Count() > 1)
                {
                    sb.Append("<br/>");

                    foreach (var s in sections)
                    {
                        if (s.Key == currentSection.Key)
                            sb.AppendFormat("<span>{0}-{1}</span>", s.First(), s.Last());
                        else
                            sb.AppendFormat("<a href=\"{2}\">{0}-{1}</a>", s.First(), s.Last(), PrepearRouteUrl(helper, pageIndexParameterName, s.First()));
                    }
                }
            }
            return MvcHtmlString.Create(sb.ToString());
        }
开发者ID:chunlei,项目名称:QrF,代码行数:35,代码来源:SeoPager.cs


示例7: FromAuctions

		public static AccountMyAuctionsViewModel FromAuctions(IPagedList<Auction> auctions,
		                                                      string titleFilter,
		                                                      int createdInDays,
		                                                      AuctionStatusFilter currentStatusFilter)
		{
			Contract.Requires(auctions != null);

			var items = auctions.Select(x => new AccountMyAuctionsViewModel.Item
			{
				Id           = x.Id,
				Title        = x.Title,
				CategoryName = x.Category.Name,
				CategoryId   = x.Category.Id,
				Status       = x.Status,
				TimeTillEnd  = x.EndDate - DateTime.Now,
				BuyoutPrice  = x.BuyoutPrice,
				BestOffer    = x.BestOffer != null ? x.BestOffer.Money : null
			});

			return new AccountMyAuctionsViewModel
			{
				Auctions            = new StaticPagedList<AccountMyAuctionsViewModel.Item>(items, auctions),
				TitleFilter         = titleFilter,
				CreatedIn           = TimeSpan.FromDays(createdInDays),
				CurrentStatusFilter = currentStatusFilter
			};
		}
开发者ID:Strachu,项目名称:Auctioneer,代码行数:27,代码来源:AccountMyAuctionsViewModelMapper.cs


示例8: Convert

        private IEnumerable<SaleProductModel> Convert(IPagedList<productDto> sources)
        {
            if (sources == null) return null;

            return sources.Select(t =>
                     {
                         var data = new SaleProductModel()
                         {
                             brandname = t.brand.name,
                             categoryname = t.category.name,
                             gendername = t.gender.name,
                             unitprice = t.unitprice,
                             code = t.code,
                             name = t.name,
                             imgpath = t.imagemain,
                             productid = t.key
                         };
                         data.details.AddRange(t.v_stocks.Select(o => new SaleProductDetailModel()
                         {
                             productid = t.key,
                             size = o.size.code,
                             displaysize = o.size.displaycode,
                             sizeid = o.sizeid,
                             stockquantity = o.stockquantity
                         }));
                         return data;
                     });
        }
开发者ID:ncqingchuan,项目名称:Hyde,代码行数:28,代码来源:ProductService.cs


示例9: BlogPager

        public static string BlogPager(this HtmlHelper helper, IPagedList pager)
        {
            // Don't display anything if not multiple pages
            if (pager.TotalPageCount == 1)
                return string.Empty;

            // Build route data
            var routeData = new RouteValueDictionary(helper.ViewContext.RouteData.Values);

            // Build string
            var sb = new StringBuilder();

            // Render Newer Entries
            if (pager.PageIndex > 0)
            {
                routeData["page"] = pager.PageIndex - 1;
                sb.Append(helper.ActionLink("Newer Entries", "Index", routeData));
            }

            // Render divider
            if (pager.PageIndex > 0 && pager.PageIndex < pager.TotalPageCount - 1)
                sb.Append(" | ");

            // Render Older Entries
            if (pager.PageIndex < pager.TotalPageCount - 1)
            {
                routeData["page"] = pager.PageIndex + 1;
                sb.Append(helper.ActionLink("Older Entries", "Index", routeData));
            }

            return sb.ToString();
        }
开发者ID:bjeverett,项目名称:asp-net-mvc-unleashed,代码行数:32,代码来源:BlogPagerHelper.cs


示例10: QuestionsModel

 public QuestionsModel(IPagedList<Question> questions, SiteState state)
 {
     SiteState = state;
     Questions = questions;
     state.Page = Convert.ToInt32(questions.CurrentPage);
     state.ItemCount = questions.TotalItems;
     state.MaxPages = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(questions.TotalItems) / Convert.ToDouble(questions.PageSize)));
 }
开发者ID:svick,项目名称:stacky,代码行数:8,代码来源:QuestionsModel.cs


示例11: 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);
 }
开发者ID:wlclass,项目名称:MvcPager,代码行数:9,代码来源:PagerExtensions.cs


示例12: 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));
 }
开发者ID:HelloAmy,项目名称:01component,代码行数:8,代码来源:PagerHelper.cs


示例13: Pager

 public static MvcHtmlString Pager(this HtmlHelper html, IPagedList list, string action, string controller)
 {
     var urlHelper = new UrlHelper(html.ViewContext.RequestContext);
     return html.PagedListPager(list,
                                page =>
                                urlHelper.Action(action, controller,
                                                 html.ViewContext.GetCombinedRouteValues(new {page = page})),
                                PagedListRenderOptions.DefaultPlusFirstAndLast);
 }
开发者ID:pate,项目名称:blog,代码行数:9,代码来源:PagingHelpers.cs


示例14: GeneratePager

 public static string GeneratePager(this HtmlHelper helper, IPagedList<object> data, string controller, string action, string pageParameter,params KeyValuePair<string, object>[] Parameters )
 {
     string url = "";
     foreach (var item in Parameters)
     {
         if(item.Value!= null)
         url += string.Format("&{0}={1}", item.Key, item.Value.ToString());
     }
     return helper.GeneratePager(data, controller, action, pageParameter, url, true);
 }
开发者ID:samuraitruong,项目名称:gmr,代码行数:10,代码来源:HtmlHelperExtensions.cs


示例15: DiscussionViewModel

        public DiscussionViewModel(Board board, IPagedList<PostViewModel> posts, int focusPostId, Competitor viewer)
        {
            Board = board;
            FocusPostId = focusPostId;
            Viewer = viewer != null && viewer.Status == CompetitorStatus.Active
                         ? new CompetitorViewModel(viewer)
                         : new CompetitorViewModel();

            Posts = posts;
        }
开发者ID:ANTco,项目名称:ChallengeBoard,代码行数:10,代码来源:DiscussionViewModel.cs


示例16: CmsPagerBuilder

            internal CmsPagerBuilder(IFrontHtmlHelper html, IPagedList pageList,
                PagerOptions pagerOptions, RouteValueDictionary routeValues, IDictionary<string, object> htmlAttributes)
                : base(html.Html, null, null, pageList, pagerOptions, null, routeValues, htmlAttributes)
            {
                frontHtml = html;
                this.routeValues = routeValues ?? new RouteValueDictionary();

                _pageList = pageList;
                this._pagerOptions = pagerOptions;
            }
开发者ID:Kooboo,项目名称:Ovaldi,代码行数:10,代码来源:PagerExtensions.cs


示例17: First

        private static TagBuilder First(IPagedList list, Func<int, string> generatePageUrl, string format)
        {
            const int targetPageIndex = 0;
            var first = new TagBuilder("a");
            first.SetInnerText(string.Format(format, targetPageIndex + 1));

            if (list.IsFirstPage)
                return WrapInListItem(first, "PagedList-skipToFirst", "PagedList-disabled");

            first.Attributes["href"] = generatePageUrl(targetPageIndex);
            return WrapInListItem(first, "PagedList-skipToFirst");
        }
开发者ID:devSolo,项目名称:PagedList,代码行数:12,代码来源:HtmlHelper.cs


示例18: RegistryItemsPage

 public RegistryItemsPage(IPagedList<Gift> gifts, IEnumerable<Category> categories, int pageSize,int selectedCategory)
 {
     Gifts =gifts.Select((gift, i) => new GiftRow {Item = gift, IsFirst = i == 0});
     Categories = categories.ToList();
     TotalNumberOfItems = gifts.TotalItemCount;
     PageNumber = gifts.PageNumber;
     PageCount = gifts.PageCount;
     FirstItemIndex = gifts.FirstItemIndex;
     LastItemIndex = gifts.LastItemIndex;
     PageSize = pageSize;
     SelectedCategoryId = selectedCategory;
 }
开发者ID:ammeep,项目名称:giftme,代码行数:12,代码来源:RegistryItemsPage.cs


示例19: GetHubsCallReturnsAnObjectResult

        public async Task GetHubsCallReturnsAnObjectResult(
            Mock<IRepository<HubDataModel>> hubRepository,
            IPagedList<HubDataModel> hubs,
            string hubSlug)
        {
            hubRepository.Setup(mock => mock.GetPaged(1, 100, null)).Returns(Task.FromResult(hubs));

            var controllerUnderTest = new HubController(hubRepository.Object);

            var result = await controllerUnderTest.GetPagedHubs(1, 100);

            Assert.IsAssignableFrom<IPagedList<HubDataModel>>(result);
        }
开发者ID:Stavrakakis,项目名称:Pickle,代码行数:13,代码来源:HubControllerTests.cs


示例20: PagedListMetaData

 ///<summary>
 /// Non-enumerable version of the PagedList class.
 ///</summary>
 ///<param name="pagedList">A PagedList (likely enumerable) to copy metadata from.</param>
 public PagedListMetaData(IPagedList pagedList)
 {
     PageCount = pagedList.PageCount;
     TotalItemCount = pagedList.TotalItemCount;
     PageNumber = pagedList.PageNumber;
     PageSize = pagedList.PageSize;
     HasPreviousPage = pagedList.HasPreviousPage;
     HasNextPage = pagedList.HasNextPage;
     IsFirstPage = pagedList.IsFirstPage;
     IsLastPage = pagedList.IsLastPage;
     FirstItemOnPage = pagedList.FirstItemOnPage;
     LastItemOnPage = pagedList.LastItemOnPage;
 }
开发者ID:chutinhha,项目名称:aiaintranet,代码行数:17,代码来源:PagedListMetaData.cs



注:本文中的IPagedList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IPalette类代码示例发布时间:2022-05-24
下一篇:
C# IPageService类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap