Edit: I am trying to bind a single view model object that contains a List to a form so that the post maps back to the same view model object.
Is there any code out there that could effectively do this in MVC 2?
EditorFor( m => m, "Students", "Students[n]") // wrong but sorta close
// the third parameter specifies the ID of the html control
// ideally, the "Students[n]" could be a prefix for the inner fields
where the html output would be:
<input id="Students[0]_Name" type="text" value="" />
<input id="Students[1]_Name" type="text" value="" />
<input id="Students[2]_Name" type="text" value="" />
and the id assembly could be within the partial "class" view (UI Template)?
...
Now that I think about it, I wonder if this would prefix all the fields with the name:
<% foreach( Student student in Model) { %><%
EditorFor( m => student, "Student",
"Students[" + Model.IndexOf(student) + "]" ) %><%
} %>
Odd... That puts that third parameter string (eg, "StuffHere") between Students and Name:
id="Students_StuffHere_Name" name="Students.StuffHere.Name"