User-1660457439 posted
This works perfectly fine on my machine:
object[] somearray = new object[] {
new { Foo = "Foo1", Bar = "Bar1" },
new { Foo = "Foo2", Bar = "Bar2" }
};
SelectList somelist = new SelectList(somearray, "Foo", "Bar", null);
ViewData["somelist"] = somelist;
Then in the view:
<%= Html.DropDownList("somelist")
%>
This produces:
<select name="somelist" id="somelist">
<option value="Foo1">Bar1</option>
<option value="Foo2">Bar2</option>
</select>
(By the way, yes, you really do want a default selected item
according to the W3C. We're considering automatically preselecting the first item if no item in the dropdownlist is selected.)