Model view controller MVC下拉列表-空错误

Model view controller MVC下拉列表-空错误,model-view-controller,Model View Controller,我已经使用实体框架生成了模型类。 这就是我得到的: public partial class Employees { public Employees() { this.Employees1 = new HashSet<Employees>(); this.Vacations = new HashSet<Vacations>(); } public int EmployeeID { get; set; }

我已经使用实体框架生成了模型类。 这就是我得到的:

public partial class Employees
{
    public Employees()
    {
        this.Employees1 = new HashSet<Employees>();
        this.Vacations = new HashSet<Vacations>();
    }

    public int EmployeeID { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string MiddleName { get; set; }
    public string Phone { get; set; }
    public string JobTitle { get; set; }
    public int ManagerID { get; set; }
    public string LastUpdatedBy { get; set; }
    public Nullable<System.DateTime> LastUpdatedDate { get; set; }
    public bool Status { get; set; }

    public virtual ICollection<Employees> Employees1 { get; set; }
    public virtual Employees Manager { get; set; }
    public virtual ICollection<Vacations> Vacations { get; set; }
}
和视图:

<div class="editor-label">
    @Html.LabelFor(model => model.ManagerID, "Manager")
</div>
<div class="editor-field">
    @Html.DropDownList("ManagerID", "--- Select Manager ---")
    @Html.ValidationMessageFor(model => model.ManagerFullName)
</div>
我的代码有什么问题

<div class="editor-label">
    @Html.LabelFor(model => model.ManagerID, "Manager")
</div>
<div class="editor-field">
  @Html.DropDownListFor(x => x.ManagerID, (IEnumerable<SelectListItem>)ViewBag.Employees1,"--- Select Manager ---"));
    @Html.ValidationMessageFor(model => model.ManagerFullName)
</div>

更多详细信息请参见此

MVC如何知道必须使用ViewBag.Employees1?使用@Html.DropDownListFormodel=>model.ManagerID,ViewBag.Employees1,--selectmanager--。它不起作用。同样的错误也会发生。当控制器中发生错误时,为什么要在视图中进行更改?
<div class="editor-label">
    @Html.LabelFor(model => model.ManagerID, "Manager")
</div>
<div class="editor-field">
    @Html.DropDownList("ManagerID", "--- Select Manager ---")
    @Html.ValidationMessageFor(model => model.ManagerFullName)
</div>
 ViewBag.Employees1 = new SelectList(employeeVM.Employees1, "EmployeeID", "ManagerFullName");
<div class="editor-label">
    @Html.LabelFor(model => model.ManagerID, "Manager")
</div>
<div class="editor-field">
  @Html.DropDownListFor(x => x.ManagerID, (IEnumerable<SelectListItem>)ViewBag.Employees1,"--- Select Manager ---"));
    @Html.ValidationMessageFor(model => model.ManagerFullName)
</div>