标签:
DDDContext db = new DDDContext(); List<SelectListItem> selectlistDistrict = new List<SelectListItem>(); foreach (var s in db.Department) { if (s.Name=="人事部") { selectlistDistrict.Add(new SelectListItem() { Text = s.Id.ToString(), Value = s.Name, Selected = true }); } else { selectlistDistrict.Add(new SelectListItem() { Text = s.Id.ToString(), Value = s.Name, }); } } ViewBag.select = selectlistDistrict;
标签:
原文地址:http://www.cnblogs.com/liucyi/p/5572779.html