Hello.
I'm creating a ASP.NET MVC App and I've got a small problem creating DropDownList with Week Days.
In database I got field "DayOfWeek" which is Integer, so randomly Scaffolded Item created code for View:
<div class="form-group">
@Html.LabelFor(model => model.DayOfWeek, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.DayOfWeek, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.DayOfWeek, "", new { @class = "text-danger" })
</div>
</div>
And I'm able to select ints there. However, I want to create DropDownList in which name of days would be stored so user can pick one day and store it's INT value in the database.
So far I created an array in model
public string[] weekDays = new string[7] { "Monday", "Tuesday", "Wednesday", .... };
[DisplayName("Day of week")]
public string[] WeekDays
{
get { return weekDays; }
}
Now I'm wondering what should I put inside the View and Controller to make it work as I would like it to.