2012-04-02 157 views

回答

1

有將DropDownList/DropDownListFor幫手,它允許你添加一個默認值的重載:

@Html.DropDownListFor(
    x => x.SelectedId, 
    (IEnumerable<SelectListItem>)ViewBag.Items, // <= yuck, use a view model instead of ViewBag/ViewCrap 
    "select from list" 
) 
相關問題