I have this line in my view
@(Html.DisplayFor(m => m.DaysOfWeek, \"_CourseTableDayOfWeek\"))
where m.DaysOfWeek is a
This seems like a bug. Html Helper classes are easy to extend, although after looking at the MVC source, looking for the bug, I gave up and just leveraged the premise that templates work for an individual item, so I wrote an HtmlHelper extension that wraps it for you. I took out the lambda expression for my own simplicity, but you can easily go back to that. This example is just for a list of strings.
public static class DisplayTextListExtension
{
public static MvcHtmlString DisplayForList(this HtmlHelper html, IEnumerable model, string templateName)
{
var tempResult = new StringBuilder();
foreach (var item in model)
{
tempResult.Append(html.DisplayFor(m => item, templateName));
}
return MvcHtmlString.Create(tempResult.ToString());
}
}
Then the actual usage looks like:
@Html.DisplayForList(Model.Organizations, "infoBtn")