我正在尝试填充一个列表框
@Html.ListBox("Employees", new MultiSelectList((IEnumerable<CubicHRM.Data.Entities.Employee>)(ViewData["Employees"]) as SelectList, "UserID", "UserName"), new { id = "sourceItems", Multiple = "multiple" })
给出以下异常
Unable to cast object of type 'System.Web.Mvc.SelectList' to type 'System.Collections.Generic.IEnumerable
ayone可以说出原因吗?
答案 0 :(得分:0)
这件事做到了
@Html.ListBox("Employees", (MultiSelectList)ViewData["Employees"], new { id = "sourceItems", Multiple = "multiple" })