How can I use Html.DisplayFor inside of an iterator?
I am loving MVC 2. The whole thing just fits the web so well. There is one piece of functionality, however, that I am unable to coax out of the Html.DisplayFor() function: <@ Page Inherits="ViewPage<IEnumerable<Foo>>"> <% foreach(var item in Model) { %> <%: Html.DisplayFor(item.BarBaz) %> <% } %> I need to be able to use the DisplayTemplate for this value. Is there a way to do this? Actually, I figured it out. How stupid of me. This works: <@ Page Inherits="ViewPage<IEnumerable<Foo>>"> <% foreach(var item in Model) { %> <%: Html.DisplayFor(m => item.BarBaz) %> <% } %> You can accomplish it by