Working with drop-down lists in ASP.NET MVC has some confusing aspects, so let’s look at an example. Imagine the goal is to edit a song (not the music and lyrics of a song – just the boring data pieces). Each song is associated with an album, and each song has a title and track number. With this description, you can imagine an edit view using the following code: <%= Html.DropDownList("AlbumId", Model.Albums)%>
...
<%= Html.TextBox("Title", Model.Title) %>
...
<%= Html.TextBox("TrackNumber", Model.TrackNumber) %>
The Html.DropDownList helper method likes to work with SelectListItem objects, so a view model you can...