Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Andy Felton 180 posts 479 karma points c-trib
    Nov 29, 2018 @ 22:29
    Andy Felton


    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 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

    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.

    Thanks Andy

  • Marc Goodson 1718 posts 11411 karma points MVP 7x c-trib
    Nov 30, 2018 @ 16:44
    Marc Goodson

    Hi Andy

    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:

    return CurrentTemplate(yourmodel);

    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"



  • Andy Felton 180 posts 479 karma points c-trib
    Dec 01, 2018 @ 17:49
    Andy Felton

    Thanks Marc,

    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!

    Thanks Andy

Please Sign in or register to post replies

Write your reply to: