I am really confused about ASP.Net MVC (2.0 RC) DropDownList. It doesn't seem to accept my selected item.
Here is my SelectListItem list (it is created inside loop. Selected being boolean)
savingTypesList.Add(new SelectListItem() { Selected = selected, Text = type.Name, Value = "" + type.SavingTypeId });
Creating SelectList itself..
return new SelectList(savingTypesList, "Value", "Text", (string)selected);
And my View..
<p>
<label for="SavingType">Saving type</label>
<%= Html.DropDownList("SavingType", Model.SavingType, "-- select a parameter saving type --", "")%>
<%= Html.ValidationMessage("SavingType", "*")%>
</p>
When I check details of the returned SelectList it show me following information
As you can see SelectedValue is set correctly and it matches to the item in the Items array. When I check the actual generated HTML there isn't any selected. What's wrong?