I have this line in my view
@(Html.DisplayFor(m => m.DaysOfWeek, "_CourseTableDayOfWeek"))
where m.DaysOfWeek
is a IEnumerable<DateTime>
.
There is the content of _CourseTableDayOfWeek.cshtml:
@model DateTime
@{
ViewBag.Title = "CourseTableDayOfWeek";
}
<th>
@System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.DayNames[(int) Model.DayOfWeek]
<span class="dateString">Model.ToString("G")</span>
</th>
And I get the following error:
The model item passed into the dictionary is of type '
System.Collections.Generic.List`1[System.DateTime]
', but this dictionary requires a model item of type 'System.DateTime
'.
If I refer to the following post:
https://stackoverflow.com/a/5652524/277067
The DisplayFor
should be looping through the IEnumerable and display the template for each item, shouldn't it?