I have the following code to bind a DropDownList for the Status property of a User Model. The Status is an enum.
The DropDownList for the first user (row 1 in the table) is rendered correctly - however subsequent rows the DropDownList is not rendered - it is rendered as an empty text box. If I use 'Vanilla Razor' DropDownList then the controls are rendered correctly - what is wrong?
Thanks
Ian
@model IEnumerable<
CLOCS.Models.ApplicationUser
>
@{
ViewBag.Title = "Index";
}
<
h2
>Index</
h2
>
<
p
>
@Html.ActionLink("Create New", "Create")
</
p
>
<
table
class
=
"table"
>
<
tr
>
<
th
>
@Html.DisplayNameFor(model => model.UserName)
</
th
>
<
th
>
</
th
>
</
tr
>
@foreach (var item in Model)
{
<
tr
>
<
td
>
@Html.DisplayFor(modelItem => item.UserName)
</
td
>
@*<
td
>
@Html.EnumDropDownListFor(modelItem => item.Status)
</
td
>*@
<
td
>
@Html.Kendo().DropDownListFor(modelItem => item.Status).BindTo(EnumHelper.GetSelectList(item.Status.GetType()))
</
td
>
<
td
>
@Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
@Html.ActionLink("Details", "Details", new { id = item.Id }) |
@Html.ActionLink("Delete", "Delete", new { id = item.Id })
</
td
>
</
tr
>
}
</
table
>