ASP.NET MVC2. Does Html.EditorForModel () work on nested data model?

My test shows it doesn't work. It ignores nested data in the model. Can anyone confirm this?

+2


a source to share


1 answer


What do you mean? If you define an EditorTemplate for a specific type, you have complete control over the HTML it displays.

It looks like you are using the default editor pattern that MVC tries to use unless you have customized a specific pattern and it should only iterate over simple properties it can find when parsing. If you create a:



\Views\<Controller>\EditorTemplates\<YourViewModelName>.ascx

      

you can make it display whatever you want.

+1


a source







All Articles