I start using ASP.NET MVC4 and I've some little troubles:) I have a viewModel that looks like this:
public class Adulte{
public string Name {get;set;}
public List<Child> Children {get;set;}
}
public class Child{
public string Name {get;set;}
public int Age {get;set;}
}
I would like to dynamically add/remove child item from my view.
@Ajax.ActionLink("Add Child",
"AddChild",
new { ???= ??? },
new AjaxOptions
{
InsertionMode = InsertionMode.InsertAfter,
HttpMethod = "POST"
}
)
.....
@using (Html.BeginForm())
{
<div id="parent">
<p>
@Html.Label("Name")
@Html.TextBoxFor(x => x.Name)
<p>
</div>
<div id="children">
</div>
<input type="submit" value="Save" />
}
But I don't know which parameter to send to the ActionLink, I test with Model as well as Model.Children without success.
This can be done?
Any help?