I want to set values of DropDownlist to 1, 2, 3, 4 , etc. & text as January, february, etc.

Following is the code:-

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" })

What should i put in place of Value = e so that all values of DropDown list should show 1, 2, 3...

Currently DropDown values show as January, February, March.

Related posts

Recent Viewed