List<Model.SysGroup> listGroup = sysGroupBll.Where(o => o.IsSb
== true, o =>
o.Id).ToList();
List<SelectListItem> items = new
List<SelectListItem>();
foreach (var group in
listGroup)
{
items.Add(new SelectListItem { Text = group.Name, Value = group.Id
});
}
this.ViewData["list"] =
items;
this.ViewData["GroupId"] = CurrentUser.SysGroup.FirstOrDefault().Id;
<td>组 @Html.DropDownList("GroupId", ViewData["list"] as IEnumerable<SelectListItem>)</td>
Html.DropDownList 选中 mvc view 弱类型,布布扣,bubuko.com
Html.DropDownList 选中 mvc view 弱类型
原文地址:http://www.cnblogs.com/huhaihua/p/3729721.html