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:
To use PagedList in .Net Core 3.0 we will use https://github.com/dncuug/X.PagedList
Open NuGet Package Manager Install X.PagedList.Mvc.Core
_ViewImports.cshtml
BrandController.cs
Index.cshtml
Change
to
Change every
To
At the the end of your html table add paging numbers like
If you make search or using other querystring you have to do something like that:
BrandController.cs
Index.cshtml At the the end of your html table add paging numbers like
For best performance use
.ToPagedList
withIQueryable
so you will return only 10 rows from the database every time not the whole rows
Use
with
Do not use .ToList()
Do not use
with