Reputation: 3515
I have enabled pagination and routing settings in global.asax like this
routes.MapRoute("Users", "Index/{page}",
new { controller = "Users", action = "Index", page = UrlParameter.Optional },
new[] { "MyProject.Controllers" });
Now I need to apply these to every controller which sends page parameter. How can I do this?
Thank you
Upvotes: 0
Views: 89
Reputation: 102753
There are two ways you can approach it.
page
parameter to all your Action methods:public ActionResult SomeAction(int? page)` { if (page.HasValue) ... }
RouteData
directly using:RouteData.Values["page"]
I guess you might want to consider creating a Base Controller that handles repetitive tasks related to paging.
Upvotes: 1