I struggled a lot with this today, I hope this post helps other people
The case
I have a form, which must contain dynamic amount of fields, depending on user input. The model for this form is Contest:
public int NumberOfRounds { get; set; }
public List<Round> Rounds { get; set; }
Round model looks like this:
public int Length { get; set; }
NumberOfRounds
field indicates the amount of Rounds a Contest contains. I use a simple js script
with "change" event listener
to add additional input fields, according to the value
of NumberOfRounds
entered by the user.
The question is how to bind those input fields to my Contest
model, in order to get their values in inside the Round.Length
property.