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
I have a Document Type (Course) and Content Items (e.g. item) within the Umbraco back office, this is normally displayed using the URL like https://mysite.com/myparent/item. I use a controller CourseController through route hijacking and view Course.chtml to render this. What I'd like, is to have an alternative view TakeCourse.chtml that uses the same controller with a different action (TakeCourse) and is accessed by the URL https://mysite.com/myparent/item/takecourse.
I've spent a while looking for how to set this up but am not finding much at the moment.
Any help/advice/links anybody can be provide will be appreciated.
It should be enough to have an Action in your controller with a name matching the name of your alternative template.
You may need to allow your document type to 'use' the alternative template you have created in the backoffice..
In your alternative action if you return like so:
then the CurrentTemplate helper is clever enough to know you requested the page via the url that would trigger the altTemplate, and returns your alternative template view.
Final thing to check if it's not working, is in config/umbracosettingsconfig in the routing element to make sure altTemplates aren't turned off!
internalRedirectPreservesTemplate="false" disableAlternativeTemplates="false" disableFindContentByIdPath="false"
That sorted it was simply a matter that I hadn't added the alternative template to the document type in the backoffice - did that and it worked straight away!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted