¿Cuál es la forma más preferida y más fácil de hacer la paginación en ASP.NET MVC? Es decir, cuál es la forma más sencilla de dividir una lista en varias páginas navegables.
Como ejemplo, digamos que obtengo una lista de elementos de una base de datos / puerta de enlace / repositorio como este:
public ActionResult ListMyItems()
{
List<Item> list = ItemDB.GetListOfItems();
ViewData["ItemList"] = list;
return View();
}
En aras de la simplicidad, me gustaría especificar solo un número de página para mi acción como parámetro. Me gusta esto:
public ActionResult ListMyItems(int page)
{
//...
}