【发布时间】:2019-10-01 10:29:53
【问题描述】:
我有一个使用 MVC 和 .Net 和 EF6 构建的网站。我想在一个视图中显示一个带有类名和姓氏的下拉列表。
我该怎么做?
我的代码是:
@Html.DropDownList("ShiftManagerId", null, htmlAttributes: new { @class = "form-control" })
班级是:
public class ShiftCalendar
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int ShiftId { get; set; }
public virtual Shift Shift { get; set; }
public DateTime Date { get; set; }
public DateTime ShiftEndTime { get; set; }
public User ShiftManager { get; set; }
public string ShiftManagerId { get; set; }
}
}
【问题讨论】:
标签: c# entity-framework model-view-controller