I am trying to bind an enum to a dropdown list. I am successful using the vanilla @Html.DropDownListFor, but unsuccessful with the @Html.Kendu().DropDownListFor.
My enum provider is:
The following code works well, showing the list and binding to the property::
However, the following displays the list, but does not bind to the property:
My enum provider is:
public static IEnumerable<SelectListItem> SexListItems{ get { foreach (var value in Enum.GetValues(typeof(Sex))) { string name = string.Format("Sex.{0}", Enum.GetName(typeof (Sex), value)); var text = Resources.Shared.EnumStrings.ResourceManager.GetString(name); yield return new SelectListItem() {Value = value.ToString(), Text = text}; } }}The following code works well, showing the list and binding to the property::
@Html.DropDownListFor(p => p.Sex, DataProviders.SexListItems)However, the following displays the list, but does not bind to the property:
@Html.Kendo().DropDownListFor(p => p.Sex).BindTo(ELSORegistry.DataProviders.SexListItems)