The action in the controller returns a partial view with a custom model passed in to it as follows:
return PartialView("ContactForm", new ContactFormModel());
Do I need to pass something in to this view so I can access the UmbracoHelper methods? I cannot inherit UmbracoTemplatePage from this view as it uses a custom model.
MVC: Using the UmbracoHelper dictionary in a Partial View with a custom model
I have a contact form child action called as follows:
@Html.Action("RenderContactForm", "ContactFormSurface")
The action in the controller returns a partial view with a custom model passed in to it as follows:
return PartialView("ContactForm", new ContactFormModel());
Do I need to pass something in to this view so I can access the UmbracoHelper methods? I cannot inherit UmbracoTemplatePage from this view as it uses a custom model.
Hi i had the same problem. I created a new property in my model NodeId.
I instanced my model in the view assigned the property value and then passed the model in to the partial.
In the partial i could then instance a new Node passing in my NodeId. Hope this helps. Charlie :)
You can also do: I think its
@inherits Umbraco.Web.Mvc.UmbracoViewPage<YourCustomModel>
its explained half way down on this page :)
http://umbraco.com/follow-us/blog-archive/2012/10/30/getting-started-with-mvc-in-umbraco-410.aspx
#H5YR Charlie. I should have clarified, I wanted to use a dictionary value with Umbraco.GetDictionaryValue("") so the second method was what I needed.
is working on a reply...