November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi,
Would this be what you're looking for?
routes.MapContentRoute(
name: "ActionWithPage",
url: "{language}/{node}/{partial}/{action}/{page}",
defaults: new { action = "Index", page = "1" }
);
That would let you pass in a page value to each action, for all routes and actions. You might be able to add a constraint to the route where you force "action" to be equal to "Page", and only then pass in the page number. Otherwise you might run into cases where this route matches all requests.
Thanks Andreas,
I'll give it a try but other priorities have come up so may be getting back on how successful I was :)
Andreas. Thanks this seems to have done the trick. I needed to tweak our code a bit but otherwise this worked. Just so everyone else knows I had to wrap it in an if statement as per feedback from http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=69513
if (!ContentReference.IsNullOrEmpty(ContentReference.StartPage))
{
routes.MapContentRoute(
name: "ActionWithPage",
url: "{language}/{node}/{partial}/{action}/{page}",
defaults: new { action = "Index", page = "1" }
);
}
Hi Everyone,
I've got a question to do with MVC Routing and pagination.
We have a Controller that defines a default 'Index' action method and a second 'Page' action method that takes a single parameter for the page to display. This works fine when we pass in the 'page' request parameter as expected.
For example, the following URL works fine:
/en-US/Services/News/Page?page=3
We understand that we need to create a custom routing to do this so we started to do this as follows but couldn't quite make it work.routeCollection.MapRoute(
"NewsArticleListing",
".*/News/{action}/{id}",
new { controller = "NewsArticleListing", action = "Index", id = "6" }
);
Additionally, this is a multilingual website and the URL will change for each locale. For example, the URL will change 'News' will be 'Nieuws' for the Netherlands. Does this mean we need to create a custom routing for each locale?