And yet ANOTHER ASP.Net MVC Bug
This is getting annoying, to tell you the truth. I am trying to develop an application here, not do QA.
Let us take the following class:
public class IdAndName { public long Id { get; set; } public string Name { get; set; } }
And the following code:
var idAndNames = new[] { new IdAndName {Id = 1, Name = "one"}, new IdAndName {Id = 2, Name = "two"} }; var list2 = new SelectList(idAndNames, "Id", "Name", idAndNames[1]); var result2 = Html.DropDownList("test",list2);
What would you expect the value of result2 to be? I would expect it to render a <select> with two items, the second of which should be selected. Here it what it is generating:
<select id="test" name="test"> <option value="1">one</option> <option value="2">two</option> </select>
Notice that there is no selected attribute on the second one.
I will suffice with GRRRRRRRRRR!!!!! at this point.

Comments
Comment preview