ASP.NET MVC UI Template: How to mix an IList Model property with EditorFor( m => m.subModel)?
问题 Say you have this: public class ShoppingCart { public IList<CartItem> cartItems {get; set; } } And you do this to render the class: <%= EditorFor( m => m.ShoppingCart, "ShoppingCart") %> How would you do the EditorFor( ??, "CartItem") in the ShoppingCart.ascx? I would think it would look something like this: <% foreach( CartItem myCartItem in m.cartItems) { %><%= EditorFor( ??, "CartItem") %><% } %> The idea here of course is to use a UI template for an entire class, not just a property. 回答1: