MVC2 Model Binding Enumerables?
- by blesh
Okay, so I'm fairly new to model binding in MVC, really, and my question is this:
If I have a model with an IEnumerable property, how do I use the HtmlHelper with that so I can submit to an Action that takes that model type.
Model Example:
public class FooModel {
public IEnumerable<SubFoo> SubFoos { get; set; }
}
public class SubFoo {
public string Omg { get; set; }
public string Wee { get; set; }
}
View Snip:
<%foreach(var subFoo in Model.SubFoo) { %>
<label><%:subfoo.Omg %></label>
<%=Html.TextBox("OH_NO_I'M_LOST") %>
<%} %>