Reputation: 1015
I have a little problem. I use the Html.DropDownListFor helper to render a dropdown list to the client.
But I can't set the selected value in dropdown list.
<%= Html.DropDownListFor(model => Model.CalculationClassCollection,
new SelectList(Model.CalculationClassCollection, "ID", "Name", 3 ),
new { id = "ddCalculationClass" })%>
Anybody can help me?
Upvotes: 2
Views: 5893
Reputation: 91
If the SelectList is not a member of my Model, I'd use <%= Html.DropDownList("listBoxID", new SelectList(Model.CalculationClassCollection, "ID", "Name", 3 ))%>
Upvotes: 3
Reputation: 13420
It is one of the overloaded methods. I think it is the method with a parameter something like default. Sorry I am not in front of dev PC right now so I can't tell you exactly which method it is.
Upvotes: 0