I have a enum and I am trying to model bind it using ASP.NET MVC.
public class MyViewModel
{
public enum ESampleTime
{
Value1= 0,
Value2,
Value3,
Value4,
Value5,
Value6
}
}
And I am trying to model bind it using ,
<div class="form-group">
@Html.LabelFor(model => model.SampleTime, htmlAttributes: new { @class="control-label col-md-2"})
<div class="col-md-2">
@Html.DropDownListFor(model => model.SampleTime,new List<SelectListItem>())
</div>
This results in empty list as I am passing a new SelectedItem
List.
But how do I display Value1, value2... in listBoix?