MVC page templates

Posted by Community Admin on 04-Aug-2018 17:03

MVC page templates

All Replies

Posted by Community Admin on 12-Sep-2012 00:00

Do I still have to create the page templates as web forms .master pages, or can I use a Razor layout instead?

Posted by Community Admin on 19-Sep-2012 00:00

bump

Posted by Community Admin on 12-Aug-2013 00:00

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?

Thanks,
Denis.

Posted by Community Admin on 15-Aug-2013 00:00

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">
    <div>
        @RenderBody()
    </div>
</div>

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.

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

This thread is closed