asp.net MVC DisplayTemplates and EditorTemplate naming convention

Posted by Simon G on Stack Overflow See other posts from Stack Overflow or by Simon G
Published on 2010-02-23T09:38:04Z Indexed on 2010/06/11 12:52 UTC
Read the original article Hit count: 877

Hi,

I've got a couple of questions about the naming convention for the DisplayTemplates and EditorTemplates in MVC 2.

If for example I have a customer object with a child list of account how do I:

  • Create a display template for the list of accounts, what is the file called?

  • When I'm doing a foreach( var c in Model.Accounts ) how do I call a display temple while in the foreach loop? When I do Html.DisplayFor( x => x ) inside the foreach x is the model and not in this case c.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about mvc