Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi, Is it possible to change the routing when I go to a page of a certain document type?
How would I do that?
Edit* Or is it possible to change which node is the current model in my _layoyt.cshml file?
Hi Tom
You can use Custom controllers (Hijacking Umbraco Routes) - https://our.umbraco.org/documentation/reference/routing/custom-controllers.
You can add any logic you want to any doctype, before razor rendering.
Thanks,
Alex
Thanks Alex! That seems to be it!
But when make another rendermodel in my new controller and return it with CurrentTemplate(_newModel) it still uses the wrong template. How do I get it to use the template the new model needs?
Got it to work by changing the action thats called:
ControllerContext.RouteData.Values["action"] = _model.Content.GetTemplateAlias();
Thanks again, Alex!
Tom, you are welcome.
Glad to help.
Have a nice day!
/Alex
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Route to other node when certain doctype is hit
Hi, Is it possible to change the routing when I go to a page of a certain document type?
How would I do that?
Edit* Or is it possible to change which node is the current model in my _layoyt.cshml file?
Hi Tom
You can use Custom controllers (Hijacking Umbraco Routes) - https://our.umbraco.org/documentation/reference/routing/custom-controllers.
You can add any logic you want to any doctype, before razor rendering.
Thanks,
Alex
Thanks Alex! That seems to be it!
But when make another rendermodel in my new controller and return it with CurrentTemplate(_newModel) it still uses the wrong template. How do I get it to use the template the new model needs?
Got it to work by changing the action thats called:
Thanks again, Alex!
Tom, you are welcome.
Glad to help.
Have a nice day!
/Alex
is working on a reply...