pagedlist

PagedList.Core.Mvc PagedListPager Html extension in .Net Core is not there

自古美人都是妖i 提交于 2019-12-05 16:38:38
It seems like the PagedList.Core does not contain the extension method for Html helper, so I cannot use the code below: @Html.PagedListPager(Model, page => Url.Action("Index", new { page }), PagedListRenderOptions.MinimalWithItemCountText) I was able to successfully implement the paging in previous version of MVC, but it does not work in ASP.Net Core. Below I have attached IL Dasm reference. Am I missing something, or is there any other way to implement that? PagedList.Mvc: PagedList.Core.Mvc: I should follow the Instructions of the new version, it is a little different from previous version.

PagedListPager pass additional model data

纵然是瞬间 提交于 2019-12-05 10:31:21
I have the following model: public class PagedClientViewModel { public int? Page { get; set; } public PagedList.PagedList<ClientViewModel> Clients { get; set; } public bool ShowAllClients { get; set; } } ShowAllClients is a checkbox that I'll use to further filter the list of clients returned from the server. @Html.CheckBoxFor(model => model.ShowAllClients, new { id = "ShowAllClientsCheckbox" }) Here is my pager: @Html.PagedListPager(Model.Clients, page => Url.Action("Index", new { Page = page }), PagedListRenderOptions.DefaultPlusFirstAndLast) Both the pager and checkbox are on the same form.

Newtonsoft.Json serialization of PagedList<T> is not including some properties

廉价感情. 提交于 2019-12-05 02:39:21
问题 I am trying to serialize a PagedList object ( https://github.com/martijnboland/MvcPaging/blob/master/src/MvcPaging/PagedList.cs ) to Json, like this: PagedList<Product> pagedList = new PagedList<Product>(products, (page - 1), pageSize); string json = Newtonsoft.Json.JsonConvert.SerializeObject(pagedList); If I use the above code, in the result I get an array of Product objects serialized properly. However the properties below (of PagedList) are not being included in the Json result: public

PagedList with Entity Framework getting all records

守給你的承諾、 提交于 2019-12-04 22:06:18
问题 PagedList is an Paging library. _dbContext.Products.ToList().ToPagedList(1, 25); Above code will get first 25 record in database for Page 1. The problem is that the ToList() call will get all record in the database. Then the ToPageList() call will select the first 25 records. How do I combine EF with PagedList so that I only get the first 25 records in the database? And not get all records, and then take the first 25 record. PS: Should I write my own Paging library or use an online library?

How to remain/retain on the same page when using PagedList.mvc

戏子无情 提交于 2019-12-04 07:04:13
I am using PagedList.Mvc and I have added a nice way to navigate across various pages in a mvc web application. However, when I click on an "edit" or "details" tab and save changes I am sent back to the 1st page. I want to remain on the same page where the changes were made. Here is the code I have in the controller: // GET: Item public ActionResult Index(int? page) { var items = db.Items.Include(i => i.PurchaseOrder); return View(items.ToList().ToPagedList(page ?? 1, 3)); } Here is the code I have in the view: @using PagedList; @using PagedList.Mvc; @model IPagedList<PurchaseOrders.Models

List does not contain a definition for 'ToPagedList'

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 02:30:57
问题 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

PagedList and Async

隐身守侯 提交于 2019-12-03 12:10:23
问题 I'm using PagedList in my Views, but my scaffolded Controller is generated with this kind of default Index Action: public async Task<ActionResult> Index() { return View(await db.Claimants.ToListAsync()); } I didn't find an extension for PagedList to work with async . My methods have to be changed to a form like this: public ActionResult Index(int? page) { var claimants = db.Claimants.OrderBy(b => b.Name); var notNullPage = page ?? 1; return View(claimants.ToPagedList(notNullPage, 50)); } Is

PagedList and Async

人盡茶涼 提交于 2019-12-03 02:37:10
I'm using PagedList in my Views, but my scaffolded Controller is generated with this kind of default Index Action: public async Task<ActionResult> Index() { return View(await db.Claimants.ToListAsync()); } I didn't find an extension for PagedList to work with async . My methods have to be changed to a form like this: public ActionResult Index(int? page) { var claimants = db.Claimants.OrderBy(b => b.Name); var notNullPage = page ?? 1; return View(claimants.ToPagedList(notNullPage, 50)); } Is there a reasonable way to work with PagedList and async ? Is there a reasonable way to work with

Using @Html.DisplayNameFor() with PagedList

橙三吉。 提交于 2019-12-02 17:26:00
I've been trying out the PagedList package to get paging for my index views. Everything was going well, and at the controller level everything is working fine, it only displays 5 records per page, and displays the appropriate page based on the querystring. My problem is in the view. I changed the @Model to PagedList.IPagedList so I could access the Model.HasNextPage and other properties, but now the @Html.DisplayNameFor(model => model.ItemName) are no longer working. I get this error: PagedList.IPagedList<Dossier.Models.Item>' does not contain a definition for 'ItemName' and no extension

toPagedList() order differs from the LINQ order by clause

泪湿孤枕 提交于 2019-12-01 18:44:36
I have a small application that displays a list of shortURLs to a user. I'm using ASP.NET MVC3, Entity Framework, and an Oracle backend. I'm also using the PagedList library by Troy Goode ( https://github.com/TroyGoode/PagedList ) I want the user to see the very last entry first, similar to how blog comments are ordered. To do this I added an "orderby descending" clause to the LINQ statement: var links = from l in db.LINKS orderby l.ID descending select l; In debug the "links" object is ordered as expected (in descending order, by the primary key "ID"). Now I want to pass this list of links to