I am displaying a list of dropDownLists inside a ForEach
loop.
This is the code
@foreach (var task in Model.TaskList)
{
<tr>
<td>@Html.DropDownList("ModuleID", new SelectList(Model.ModuleList, "ModuleID", "Ordre"))
</td>
</tr>
}
I want the Module
of each Task
to be selected by default. This could easily be done using DropDownList
if only I was binding the dropDownList to a view model, but that's not the case.
Any ideas ?