More in this section

Forums / Developing with Sitefinity / MVC page templates

MVC page templates

4 posts, 0 answered
  1. Dave
    Dave avatar
    29 posts
    31 Oct 2011
    12 Sep 2012
    Link to this post
    Do I still have to create the page templates as web forms .master pages, or can I use a Razor layout instead?
  2. Basem
    Basem avatar
    131 posts
    22 Dec 2010
    19 Sep 2012
    Link to this post
  3. Denis
    Denis avatar
    105 posts
    27 Feb 2009
    12 Aug 2013 in reply to Dave
    Link to this post
    You can modify root MVC template with PowerTools. Does any one knows if this is possible to use different root templates depending different criteria: MVC controller or user settings in profile?

  4. Tosho Toshev
    Tosho Toshev avatar
    8 posts
    15 May 2014
    15 Aug 2013
    Link to this post
    Hi Denis,

    It is not possible to change your root template on the fly because when the controller classes are executed, the page is already built and it is too late to change the root template.
    You can create a layout file with a content like this:
    <link href="@Url.Content("~/Mvc/Content/MyStyle.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Mvc/Scripts/MyScript.js")" type="text/javascript" />
    <div class="bodyClass">

    In each view, you could set your Layout explicitly like this:

        Layout = "~/Mvc/Views/Shared/_MyCustomLayout.cshtml";
    The layout file shouldn't contain elements like head, body or title because they are already contained in the root template.

    Tosho Toshev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
4 posts, 0 answered