DropdownListFor default value
asp.net-mvc-3
Solution
So, I did something like this:
@Html.DropDownListFor(model => model.Dessert,
new SelectList(Model.AvailableDesserts, "DessertID", "DessertName"),
"---Select A Dessert ---")
Seems to work pretty well. `Dessert` in my viewmodel is the one selected by the user. `AvailableDesserts` is a collection of ones to pick from.
Problem
Is there a simple way to add a "--Please select--" default option to a DropDownListFor in MVC 3?