0
var userColor = db.userColor;
foreach(var x in userColor){
var correspondingDropDownValue = from m in db.user
where m.UserID == x.UserID
select m;
ViewData["dropDown_Color"] = correspondingDropDownValue.Select(j => new SelectListItem { Text = j.ListOfValue, Value = j.ListOfValue }).ToList();
}
在此db.userColor表中有另一個名爲db.userColor.default的列,其中包含一個用作默認值的值。我如何修改上面的代碼來設置選定的值?MVC DropDownList設置默認值