asp.net mvc选择列表

时间:2010-08-29 06:37:12

标签: asp.net-mvc

通过使用选择列表我如何输入请选择。有没有办法

 GrpDown = new SelectList(_db.Groups.Where(m => m.vcr_GroupName != "SuperAdmin" && m.int_Priority >= Authorization.Priority && m.bit_Active == true).ToList(), "int_GroupId", "vcr_GroupName");

1 个答案:

答案 0 :(得分:2)

我希望我理解你的问题。尝试以下几点:

var ListOfThings = _db.Groups.Where(m => m.vcr_GroupName != "SuperAdmin" && m.int_Priority >= Authorization.Priority && m.bit_Active == true).ToList();

ListOfThings.Insert(0, "Please Select"); // <-- Here you want to enter an item that has the caption "Please Select"

GrpDown = new SelectList(ListOfThings, "int_GroupId", "vcr_GroupName");