我想将DropDownlist的值设置为1,2,3,4等。&文字为1月,2月等。
以下是代码: -
public enum InputMonths
{
January = 1,
February = 2,
March = 3,
April = 4,
May = 5,
June = 6,
July = 7,
August = 8,
September = 9,
October = 10,
November = 11,
December = 12
}
@Html.DropDownListFor(model => model.ApplyMonth, Enum.GetNames(typeof(Models.InputMonths)).Select(e => new SelectListItem { Text = e, Value = e }), "-- Select Month --", new { @class = "form-control", @id = "ApplyMonth" })
我应该代替Value = e
,以便DropDown列表的所有值都显示为1,2,3 ......
目前DropDown值显示为1月,2月,3月。