I am currently developing some functionality within Umbraco and have a question regarding Surface Controllers.
I would like to basically return my own Model into a View created within Umbraco.
For example
I have created a DocumentType of "Home" and a Template of "Home" within the backend and I have a SurfaceControler then returns the below.
return View("~/Views/Home.cshtml", model);
Error I'm getting is
The model item passed into the dictionary is of type 'Umbraco.Web.Models.RenderModel', but this dictionary requires a model item of type 'Namespace.Model'.
I can use
@Html.Action("Name", "Names") and this works fine.
So basically I need to be able to pass my "Namespace.Model" into a normal Umbraco created View.
Surface Controller
Good Evening,
I am currently developing some functionality within Umbraco and have a question regarding Surface Controllers.
I would like to basically return my own Model into a View created within Umbraco.
For example
I have created a DocumentType of "Home" and a Template of "Home" within the backend and I have a SurfaceControler then returns the below.
return View("~/Views/Home.cshtml", model);
Error I'm getting is
The model item passed into the dictionary is of type 'Umbraco.Web.Models.RenderModel', but this dictionary requires a model item of type 'Namespace.Model'.
I can use
@Html.Action("Name", "Names") and this works fine.
So basically I need to be able to pass my "Namespace.Model" into a normal Umbraco created View.
@model Namespace.ViewModels.NameViewModel
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using ContentModels = Umbraco.Web.PublishedContentModels;
I hope this makes sense.
Thank you. Alex
Hi Alex
To help with understanding the issue, are you able to post complete code snippets ?
So your view, your partial, your controller - appreciate it might be a bit of code, but it makes it easier to track down where the issue is.
Cheers
Nigel
is working on a reply...