Given the following situation:
I have a model that contains various properties, one of those properties is a List. The model is the following:
public class DocumentTypeViewModel : BaseViewModel<int>
{
#region Properties
public string Name { get; set; }
public List<DocumentTypeProperty> Properties { get; set; }
#endregion Properties
}
The DocumentTypeProperty, has just a single field with a name (and off course an id, but that's not important here).
Now, the ActionResult to show the view on which the create will happen is the following:
public ActionResult Create()
{
var model = Mapper.Map<DocumentType, DocumentTypeViewModel>(new DocumentType());
return View(model);
}
So, as you see, I send an empty model to the view, so the collection is null. Now, on in my Razor view i want to have an add button that I can use to add an element to the collection (I know that I can use jQuery to create elements), but I don't want to post it since it's not needed, the post will occur on the save of the model.
So the question is:
How can I pass my dynamiccly created textboxes to my ActionResult?
Kind regards,