I am creating a drop down list of months for a registration form and I have used an enumerable range (0-12) for the database. The problem is, I'm trying to add month names to make the form more user friendly, but I don't know how.
Here's the variable:
var months = Enumerable.Range(1, 12).Select(x => new SelectListItem { Value = x.ToString("0"), Text = x.ToString() });
Here's the dropdown list:
@Html.DropDownList("", months, "Month", new { @id = "monthDropdown", @class = "selectpicker" })
How do I bind a string to each of the numbers in the range?