0
When I try to go to page 2, it shows the site loading, but only brings me the first page information of my page 1. My Controller:
public ActionResult Index(int? page)
{
IList<Abastecimento> abastecimento = dao.Lista();
page = 1;
int NumRegistro = 10;
int NumPag = (page ?? 1);
return View(abastecimento.ToPagedList(NumPag, NumRegistro));
}
My View:
Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount
@Html.PagedListPager(Model, page => Url.Action("Index", new { page }))
You have to pass the page number to the method
Lista()
and make the method return only the amount of items referring to that page. In this code, the methodLista()
brings everything from the bank and makes the pagination oncontroller
. When you have thousands of records, a page will take too long to display.– Armindo Gomes