QPager is asimple Library for ASP.NET Core Projects.
Install-Package QPager
- Add namespace to your Page
@using QPager
2.Call PagedList
helper like below
@Html.PagedList(currentPage, totalPage, page => Url.Action("Index", new { page }))
currentPage
andtotalPage
are some variables or viewbags
if you want to change default 'Next' and 'Prev' title you can doing this by passing another param like below
@Html.PagedList(currentPage, totalPage, page => Url.Action("Index", new { page }),new QPageOptions { NextPageTitle="Next Page",PrevPageTitle="Prev Page"})
- Qpager uses bootstrap css , this mean you have to add bootstrap.css to all pages that you want to have pagination .if you don't like to use bootstrap you could add some css to decorate your pagination.
2.you have to update you CurrentPage
int your action Like below :
public IActionResult Index(int page=0)
{
ViewBag.currentPage = page++;
return View();
}