I have an action Method ReleasingTheaters in Movie controller, The ReleasingTheaters has two overload one is httpGet which accepts the Movie Id and do stuff and return the Rele
You need to change your foreach
to a for
loop so that the controls are correctly named and can be bound by the DefaultModelBinder
@for (int i = 0; i < Model.ReleasingTheaters.Count; i++)
{
@Html.TextBoxFor(m => m.ReleasingTheaters[i].DateFrom)
....
}
This will generate inputs such as
<input type="text" name="ReleasingTheaters[0].DateFrom" id="ReleasingTheaters_0__DateFrom" value="?" >
<input type="text" name="ReleasingTheaters[1].DateFrom" id="ReleasingTheaters_1__DateFrom" value="?" >
Note also that you should not be setting the id
attribute with new { id = "DateFrom" }
etc. The helpers will render a unique id but you are creating duplicate id's which is invalid html