Showing posts with label HTML.Dropdownlist. Show all posts
Showing posts with label HTML.Dropdownlist. Show all posts

Monday, April 27, 2009

ASP.NET MVC Html.DropDownList

It took me a little while to figure out how to add custom items to an ASP.net MVC Html dropdownlist.  

It takes an IEnumerable of type SelectedList, not just any IEnumerable.  What I had to do was create a List and then make a SelectedList and put that List in the selected list for it to work.

Like this: