I am trying to store a DateTime object into my SQL database using ASP.NET MVC.
@Html.DropDownListFor(model => model.ModifiedDate, Enumerable.Range(1, 31).Select(i => new SelectListItem { Value = i.ToString(), Text = i.ToString()}), "-- Select Day --")
@Html.DropDownListFor(model => model.ModifiedDate, Enumerable.Range(1, 12).Select(i => new SelectListItem { Value = System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat.GetMonthName(i), Text = System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat.GetMonthName(i) }), "-- Select Month --")
@Html.DropDownListFor(model => model.ModifiedDate, Enumerable.Range(2018, 5).Select(i => new SelectListItem { Value = i.ToString(), Text = i.ToString()}), "-- Select Year --")
@Html.ValidationMessageFor(model => model.ModifiedDate, "", new { @class = "text-danger" })
I am using three (3) DropDownListFor day, month and year respectively.
Is there a way to successfully store all 3 inputs from each dropdown to be stored as one single date in my ModifiedDate column?