vendredi 4 novembre 2016

There is no ViewData item of type 'IEnumerable

Controller

DepartmentLevel departmentlevel = new DepartmentLevel();
ViewBag.DepartmentLevel = new SelectList(db.DepartmentLevels, "DepartmentLevelId", "DepartmentLevelDesc", departmentlevel.DepartmentLevelId).OrderBy(a => a.Text);

HTML

 @Html.DropDownList("DepartmentLevel", ViewData["DepartmentLevel"] as SelectList, "All Department", new { @style = "width:200px;" })

What is the problem?.

Aucun commentaire:

Enregistrer un commentaire