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
时间: 2024-10-26 08:36:40