Hi, are you having trouble passing to a partial view?. What i did was created a public property NodeId {get;set;} in my model. In my view i instanced my model and set NodeId to the context nodeId (Node.GetCurrent().Id) and then passed this instance into the partial. In the partial i can then say
@model Koit.Models.ContactModel() // @Model to get these properties
DynamicNode ctxNode = new DynamicNode(@model.NodeId)
Where T is your custom model. This helped me greatly when creating forms in multi-languages. I used the Dictionary and a custom model to send the form data to an external API in my controller.
UmbracoTemplatePage with custom model
Hi! Is it possible to have a custom model with a UmbracoTemplatePage like that :
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<Koit.Models.ContactModel()> ?
I know I can use a partial view to get my ContactModel but I also need every Umbraco.Field("").
Thank you for your help!!!
Dave
Hi, are you having trouble passing to a partial view?. What i did was created a public property NodeId {get;set;} in my model. In my view i instanced my model and set NodeId to the context nodeId (Node.GetCurrent().Id) and then passed this instance into the partial. In the partial i can then say
@model Koit.Models.ContactModel() // @Model to get these properties
DynamicNode ctxNode = new DynamicNode(@model.NodeId)
ctxNode....
Hope this makes sense. Charlie :)
I came across this issue in 7.1.8 +...
The best answer to this question is located here in documentation.
Instead of using
Which will not recognize a custom model, use...
Where T is your custom model. This helped me greatly when creating forms in multi-languages. I used the Dictionary and a custom model to send the form data to an external API in my controller.
is working on a reply...