Hi
I have the model
public class PersonViewModel
{
public Guid Id { get; set; }
public string Firstname { get; set; }
public string Lastname { get; set; }
}
which is nested in an other view model:
public class ApprovalModel
{
[UIHint("MyDisplayTemplate")]
public PersonViewModel User { get; set; }
[Required]
public bool? Approve { get; set; }
}
Under Views -> Shared -> DisplayTemplates I have the template MyDisplayTemplate.ascx
In my view ApprovalModel view I use the following line, which displays the nested model:
<div class="display-field"> <%: Html.DisplayFor(model => model.User) %> </div>
And in my controller I have the action
[HttpPost]
public virtual ActionResult ApproveRequest(ApprovalModel vm)
{
//access bound vm.User here
}
Is there a simple way to bind the nested model back with the post request? Or what else can I do to bind it back?
thanks