IEnumerable model property in an ASP.NET MVC 3 Editor Template
问题 I have a model which has an IEnumerable property (warning pseudo-code to follow) public class PersonModel { public string Name { get; set; } public IEnumerable<AddressModel> Addresses { get; set; } } public class AddressModel { public string Name { get; set; } } I want to display the Address sub-objects in the same view Person.cshtml @model PersonModel <form> <h2>Person</h2> @Html.EditorFor(m=>m.Name) <ul>@Html.EditorFor(m=>m.Addresses)</ul> </form> EditorTemplate/AddressModel @model