I'm loading a ListBox from a model which looks like this
public class FilterModel
{
public Learning TypeOfLearning { get; set; }
public TeachingYear Teaching { get; set; }
}
public enum Learning
{
All,
Frameworks,
Qualifications,
Units,
Standards
}
public enum TeachingYear
{
2016/2017,
2017/2018,
2018/2019,
2019/2020
}
The values are loaded into my ListBox as below
@Html.DropDownList("LearningType", new SelectList(Enum.GetValues(typeof(Learning))),
"Select Learning Type", new { @style = "width: 350px" })
@Html.DropDownList("TeachingYeare",
new SelectList(Enum.GetValues(typeof(TeachingYear))),
"Select Teaching Year", new { @style = "width: 350px" })
Learning works fine but TeachingYear objects to the numeric values which I've tried parsing but it still wont run. How do I set up my enum to correctly display the date range values?