I am trying to apply a "Layout" to an MVC View called from an Umbraco Surface Controller. But when I add the following to be beginning of the file:
@{
Layout = "TTMaster.cshtml";
}
I get the following exception error:
The model item passed into the dictionary is of type 'MyProject.Models.TT_ViewProfile.ViewProfileViewModel',
but this dictionary requires a model item of
type 'Umbraco.Web.Models.RenderModel'.
My Controller calls the view with this:
return View("ViewProfile", viewProfileViewModel);
and below is the source for the View. Any help would be appreciated.
I still have a problem with this, but here is some more information:
Note that this page uses a custom route.
Also, when I remove the following from my Layout Page (and move the Layout Page into my Views folder) the page works:
inherits Umbraco.Web.Mvc.UmbracoTemplatePage
it seems that this is conflicting with the following in my View page:
@inherits Umbraco.Web.Mvc.UmbracoViewPage
However removing "inherits Umbraco.Web.Mvc.UmbracoTemplatePage" from my master Layout page will break the Umbraco pages and I want to have one Layout Template page for my whole site (both Umbraco Pages and pages with custom route pages) is that possible ?
Errors applying a "Layout" to an Umbraco MVC View
Hi all,
I am trying to apply a "Layout" to an MVC View called from an Umbraco Surface Controller. But when I add the following to be beginning of the file:
I get the following exception error:
My Controller calls the view with this:
and below is the source for the View. Any help would be appreciated.
Terry Clancy
ClanceZ
I still have a problem with this, but here is some more information:
Note that this page uses a custom route.
Also, when I remove the following from my Layout Page (and move the Layout Page into my Views folder) the page works:
inherits Umbraco.Web.Mvc.UmbracoTemplatePage
it seems that this is conflicting with the following in my View page:
@inherits Umbraco.Web.Mvc.UmbracoViewPage
However removing "inherits Umbraco.Web.Mvc.UmbracoTemplatePage" from my master Layout page will break the Umbraco pages and I want to have one Layout Template page for my whole site (both Umbraco Pages and pages with custom route pages) is that possible ?
Thanks again
Terry Clancy
ClanceZ
+1 here
Two ways I understand to get around this problem
Either make an Umbrcao Template and use the method:
Or from your controller use TempData["mod"] = [your model variable] example below
then in the page you can unpack it:
is working on a reply...