//角色类别(下拉框) private void selectRole() { List <SelectListItem> list = new List <SelectListItem>(); var dt = irb.SelectAll(); foreach (var dr in dt) { SelectListItem cl = new SelectListItem() { Value = dr.RoleID.ToString(), Text = dr.RoleName.ToString() }; list.Add(cl); } ViewData["role"] = list; }