I am using PagedList in a fully functional pager and it is generating the query string for the indexed pages as expected. I wanted to know if there is a way the URL could be customized to eliminate the query string and add another Route parameter instead. The following is my View :- <pre> @model PagedList.Core.IPagedList<ActionAugerMVC.Models.Review> @using PagedList.Core.Mvc; @addTagHelper *, PagedList.Core.Mvc <div id='Paging' style="text-align:center"> Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount <pager class="pager-container" list="@Model" options="@PagedListRenderOptions.TwitterBootstrapPager" asp-action="Index" asp-controller="Review" /> </div>
[Route("Reviews/calgary-tech-reviews")] public IActionResult Index(int? page) { int pageSize = 10; int pageIndex = 1; pageIndex = page.HasValue ? Convert.ToInt32(page) : 1; var review = unitOfWork.ReviewRepository.GetAll(); return View(review.OrderByDescending(m=> m.Date).ToPagedList(pageIndex,pageSize)); }
http://localhost:63613/Reviews/calgary-tech-reviews?page=2
http://localhost:63613/Reviews/calgary-tech-reviews/page-2/
http://localhost:63613/Reviews/page-2/calgary-tech-reviews/
[Route("Reviews/calgary-tech-reviews/page={page:int}")]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)