Umbraco 13 and in a view I have a hyperlink. I'm trying to pass in some data from this view to a controller (surface controller)
The model is
Public Customer MCustomer
{
public string FreeText {get; set;}
public CustomModel Custom {get; set;}
}
In my view I add
<a href="@Url.SurfaceAction("myMethod", "CustomSurface", new MCustomer{CustomModel = new CustomModel {propOne="hello"}, FreeText= "this is free text"})"> Test</a>
In this scenario the free text content comes through but the custom model doesn't? Why and how can I resolve this?
How to pass complex model to SurfaceAction
Hi
Umbraco 13 and in a view I have a hyperlink. I'm trying to pass in some data from this view to a controller (surface controller)
The model is
In my view I add
In this scenario the free text content comes through but the custom model doesn't? Why and how can I resolve this?
Thanks
Hey Keith, update your model class like below
and bind your values to the model object like below in the razor view
and finally call your anchor tag element with method name, controller name and data object model
is working on a reply...