I would like to assign a static list of items in a SelectList() to a Html.DropDownList() in ASP.NET MVC, what is the best practice?
I was about to try to find a way to use new SelectList(new {key = "value"}... but one, that didn’t work, and two, would I be breaking a law here, should my static list be declared in ViewData anyway and passed as IList/IENumerable?
OK I decided to take my own advice, and this should be defined in the controller:
FYI, I just returned:
… (ignore context) and in the View ASPX side:
If anyone has a more optimal way of doing this I’ll be happy to accept their answer.