ASP.NET MVC2 - Does Html.EditorForModel() work on the nested data model?
My test shows it doesn't work. It ignores the nested data in model. Can anyone con开发者_StackOverflow社区firm this?
What do you mean? If you are defining an EditorTemplate for a specific type, you have complete control over the HTML it renders.
It sounds like you are using the 'default' editor template that MVC tries to use if you haven't set up a specific template, and it should only iterate over those simple properties it can find with analysis. If you create a:
\Views\<Controller>\EditorTemplates\<YourViewModelName>.ascx
you can then make it display whatever you want.
精彩评论