I got this working by creating a property on the Viewmodel which is used for binding to the selecteditem in the DropDownList. An example will make it clear:
The code in the View:
<div class="editor-field">
@Html.DropDownListFor(model => model.SelectedPlantID,
new SelectList(Model.Plants, "Value", "Text"),
" ", new { id = "ddlPlant" })
@Html.ValidationMessageFor(model => model.SelectedPlantID)
</div>
The code in the ViewModel will be(strongly typed to the view):
private List<SelectListItem> _plants = new List<SelectListItem>();
[Required]
[Display(Name = "Plant")]
public List<SelectListItem> Plants
{
get
{
return (_plants);
}
set
{
_plants = value;
}
}
public Guid SelectedPlantID
{
get;
set;
}
Note : the SelectedPlantID does not have to be a field on your model.
Hope this works for you!