I have a page with the model below
@model Justice.Domain.MyClasses.Employeekronosdisplay
I am using the dropdownlistfor below
@Html.DropDownListFor(m => m.GetEmpHoursDateRange.selectedEmplhoursdate,
Model.GetEmpHoursDateRange.EmphoursdateSelectList,
new { id = "procDateId" })
Here is the model I am using
public class Employeekronosdisplay
{
public Setemployeehoursdate GetEmpHoursDateRange { get; set; }
}
Here is another model I use to get all my data to the view.
public class Setemployeehoursdate
{
public string selectedEmplhoursdate { get; set; }
public IEnumerable<SelectListItem> EmphoursdateSelectList { get; set; }
}
Problem : This is a dropdown for a date and I expect that the date I pass to the selectedEmplhoursdate property is what should be the default in my dropdown. I am able to pass the right date without any problem to selectedEmplhoursdate
However the dropdown is not showing the selectedEmplhoursdate I specify. It is showing another date which seems to be the first item in my selectList
How can I resolve this? I want to be able to pass a default date.