Umbraco 4.10.0

Umbraco 4.10.0

New to Umbraco 4.10.0 is the integration of MVC. Instead of templates using WebForms you can use MVC views. To do this, in the file ~/config/umbracoSettings change the line 

<defaultRenderingEngine>WebForms</defaultRenderingEngine>

to 

<defaultRenderingEngine>Mvc</defaultRenderingEngine>

and from now on whenever you create a new template you will be using MVC views. If you want to use inheritance on your templates then it is as easy as changing

@{
Layout = null;
} to

@{
Layout = "MasterPage.cshtml"; <-- Inherits MasterPage template
} You can also use the drop down menu and set the template you want it to be under.

Master VC Plate Inheritance

A few of the tags which are important for your MVC views are 

@RenderSection("head", false) which is equivilant to <asp:contentPlaceHolder runat="server" id="head"> and @RenderBody() which will render any content from a child template which isn't inside a named section.

For rendering macros in a MVC view @Umbraco.RenderMacro("macroAlias", new { parameterName = "Parameter Value", secondParameter = "Second Value" }).

Also important is the new UmbracoHelper, @Umbraco. This is essentially @library. One more feature which I found important is if you have existing WebForms and you want to switch them over then you can create a .cshtml file with the same name as your WebForm and umbraco will automagically use your .cshtml file.

 

Get it straight from the source! (Where I got my information)

Blog Post By Sebastiaan Janssen

Umbraco new pipeline by Stephan

MVC Documentation

Shannon Deminick's Blog

A Second Shannon Deminick's Blog

And if you are new to MVC

Author

Wesley Kos

comments powered by Disqus
back to top