pagedlist

List does not contain a definition for 'ToPagedList'

↘锁芯ラ 提交于 2019-12-01 14:24:02
I'm using the PagedList.Mvc NuGet Package for paging, In a View everything seems to works perfectly nice but in my controller this error occurs 'System.Collections.Generic.List<CreateSocial.Models.UserProfiles>' does not contain a definition for 'ToPagedList' and no extension method 'ToPagedList' accepting a first argument of type 'System.Collections.Generic.List<CreateSocial.Models.UserProfiles>' could be found (are you missing a using directive or an assembly reference?) even though I defined the namespace like: using PagedList; using PagedList.Mvc; my code look like this: [HttpGet] public

The type 'IEnumerable<>' is defined in an assembly that is not referenced

时光总嘲笑我的痴心妄想 提交于 2019-12-01 02:23:38
I have added the following nuget package to my MVC 5 application X.PagedList.Mvc I return the results in my controller/view as follows: // Repo public IPagedList<Post> GetPagedPosts(int pageNumber, int pageSize) { var posts = _context.Post .Include(x => x.Category) .Include(x => x.Type); // Return a paged list return posts.ToPagedList(pageNumber, pageSize); } // View model public class PostViewModel { public IPagedList<Post> Posts { get; set; } ... } // Controller method public ActionResult Index(int? page) { int pageNumber = page ?? 1; int pagesize = 5; var posts = _PostRepository

The type 'IEnumerable<>' is defined in an assembly that is not referenced

心已入冬 提交于 2019-11-30 22:02:49
问题 I have added the following nuget package to my MVC 5 application X.PagedList.Mvc I return the results in my controller/view as follows: // Repo public IPagedList<Post> GetPagedPosts(int pageNumber, int pageSize) { var posts = _context.Post .Include(x => x.Category) .Include(x => x.Type); // Return a paged list return posts.ToPagedList(pageNumber, pageSize); } // View model public class PostViewModel { public IPagedList<Post> Posts { get; set; } ... } // Controller method public ActionResult

PagedList error: The method 'OrderBy' must be called before the method 'Skip'

岁酱吖の 提交于 2019-11-30 11:49:15
Here's the full error message: The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip' In the "PurchaseOrderController" I have added this code to the index method: // GET: PurchaseOrder public ActionResult Index(int? page) { return View(db.PurchaseOrders.ToPagedList(page ?? 1, 3)); } Also in the Index View for "PurchaseOrders" I have added this code: @using PagedList; @using PagedList.Mvc; @model IPagedList<PurchaseOrders.Models.PurchaseOrder> @{ ViewBag.Title = "Index"; } <h2>Index</h2> <p> @Html.ActionLink("Create

AJAX pagedlist with partial view

人盡茶涼 提交于 2019-11-29 14:37:36
问题 I can't quite figure out how to get a partial view to render a paged list using ajax. The closest I've got it to working is the example from Using paging in partial view, asp.net mvc I'm basically trying to create a page with a list of comments per user where the page can be changed in the same way as the answers tab on the stackoverflow users page. The paging works fine the on the first pager click, but then the the partial view is all that is returned once I click on the pager again.

PagedList using LINQ Skip and Take, but show paging using Count of results

两盒软妹~` 提交于 2019-11-28 23:10:54
I am trying to display a filtered list of of products, based on Category filter and ItemsPerPage but I'm having some issues when trying to use it with PagedList. Someone with PagedList expertise could advice me if I need to write my own pagination code or is there a way to get the results I need using PagedList. I am using LINQ's Skip & Take functions to get only the number of rows that need to be displayed on the current page, but I would still like paging links to show pages based on the filter's total count. E.g.: my search filter finds 50 results, but since my rows per page is say 10 items

Using paging in partial view, asp.net mvc

心已入冬 提交于 2019-11-28 16:55:07
I'd greatly appreciate if someone could advise on following: In my view I display the list of items: @model PagedList.IPagedList<Items> @using PagedList.Mvc; @foreach (var item in Model) {//displaying data} my pager looks like this: @Html.PagedListPager(Model, page => Url.Action("Index", new { humanID = ViewBag.HumanID, page = page }), new PagedListRenderOptions { LinkToFirstPageFormat = "<<", LinkToPreviousPageFormat = "prev", LinkToNextPageFormat = "next", LinkToLastPageFormat = ">>", }) The problem is that when I click on the next page it is returned blank, without my _Layout . I wouldn't

MVC posting IPagedList

六眼飞鱼酱① 提交于 2019-11-28 12:37:06
I have the following PagedListModel: public class PagedClientViewModel { public int? Page { get; set; } public PagedList.IPagedList<ClientViewModel> Clients { get; set; } } public class ClientViewModel { public string ClientNumber { get; set; } public bool UseThisClient{ get; set; } } My view looks like this: @using (Html.BeginForm("Index", "Home", FormMethod.Get, new { id = "Form" })) { @foreach (var item in Model.Clients) { @Html.DisplayFor(modelItem => item.ClientNumber) @Html.CheckBoxFor(modelItem => item.UseThisClient) } @Html.HiddenFor(model => model.Clients) } Controller Action: public

Ajax Pagination in PagedList.MVC using partial Page

和自甴很熟 提交于 2019-11-27 18:23:56
PagedList.Mvc is working fine if I do not use partial page but when I use partial page with ajax to load the grid then there is problem in pagination.and I ended with the support from TroyGoode https://github.com/TroyGoode/PagedList/issues/26#issuecomment-6471793 , But link provided for the support is not working. Right now, I have used like this @Html.PagedListPager((IPagedList)Model.MovieInforamtions, page => Url.Action("GetMovieDatabase", new { page })) , which loads the page but I need to change the pagination ajaxically. How can I achieve this? Yogendra Paudyal This issue is solved by

PagedList using LINQ Skip and Take, but show paging using Count of results

南楼画角 提交于 2019-11-27 14:34:15
问题 I am trying to display a filtered list of of products, based on Category filter and ItemsPerPage but I'm having some issues when trying to use it with PagedList. Someone with PagedList expertise could advice me if I need to write my own pagination code or is there a way to get the results I need using PagedList. I am using LINQ's Skip & Take functions to get only the number of rows that need to be displayed on the current page, but I would still like paging links to show pages based on the