For a while now I have tried to work my head around this small issue. Research done only confused me more and some attempts did not work.
So, if you think you can help me ease my pain, I will appreciate it greatly!
I'm new to ASP.NET MVC4 Mobile applications, I am creating a simple registration page with only a few details, one of them is Date of Birth, which I would prefer to be a set of dropdownlist instead of datepicker (as it is for mobiles I want it to be simple :) ).
Here is the bit of code that populates my dropdownlists in my View page:
<fieldset data-role="controlgroup" data-type="horizontal">
<legend>D.O.B</legend>
@Html.DropDownList("Day", Enumerable.Range(1, 31).Select(i => new SelectListItem { Value = i.ToString(), Text = i.ToString()}), "Day")
@Html.DropDownList("Month", Enumerable.Range(1, 12).Select(i => new SelectListItem { Value = i.ToString(), Text = System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat.GetMonthName(i)}), "Month")
@Html.DropDownList("Year", Enumerable.Range(1900, 114).Select(i => new SelectListItem { Value = i.ToString(), Text = i.ToString()}), "Year")
</fieldset>
I wanna be able to "map" the values from here to my Register model which right now it looks like this:
[DataType(DataType.Date)]
public DateTime BirthDate { get; set; }
Any help or straight answer will be greatly appreciate it. If you need more info please feel free to ask. Thank you very much.
Regards