i have set up simple paging system in my app that is using the idea from nerddinner tutorial, using the paginated list class:
public class PaginatedList<T> : List<T> {
public int PageIndex {}
public int PageSize {}
public int TotalCount {}
public int TotalPages {}
public PaginatedList(IQueryable<T> source, int pageIndex, int pageSize){}
public bool HasPreviousPage {}
public bool HasNextPage {} }
The paging works, and i am using it to get the long tables from the database via LINQ2SQL, as in this controller action:
public ActionResult Index(int page=0)
{
const int pageSize = 10;
var source = repo.SvaMjesta();
var paginatedList = new PaginatedList<Mjesto>(source, page, pageSize);
return View(paginatedList);
}
The paging works fine, i can get to any page as long as i am using query type o URL: /Admin/Mjesta?page=2
That is something i wish to avoid, and would like to use simple URL like: /Admin/Mjesta/Page/2
To that purpose i have made this entry in my AdminAreaRegistration.cs
context.MapRoute(
"pMjesta",
"Admin/Mjesta/Page/{page}",
new {controller = "Mjesta", action = "Index"});
But when i try to access URL such as /Admin/Mjesta/Page/2 , it still throws me a 404 error.
My idea was to build some sort of general paging entry in MapRouting at first, so i can use the same partial view to render paging controls with every list where i have such need, but as i couldn't make it work i have tried this more specific approach, but i am still not able to get the controller to react to this URL request.
Any ideas and/or suggestions please?