我收到以下错误:
表达式树可能不包含动态操作
以下是模型:
public class ProjectType
{
public string Project { get; set; }
public string Name { get; set; }
public string Server { get; set; }
}
public class ProjectTypesViewModel
{
public int SelectedId { get; set; }
public IEnumerable<ProjectType> ProjectTypes { get; set; }
}
这是视图:
@using BankruptcyDocketGenerator.ViewModels
@{
ViewBag.Title = "Bankruptcy Docket Generator";
}
@{
ProjectTypesViewModel projectTypes = (ProjectTypesViewModel)ViewBag.ProjectTypes;
}
@Html.DropDownListFor(x => x.SelectedId, new SelectList(projectTypes.ProjectTypes, "Project", "Name"), "Select one...")
我究竟做错了什么?
谢谢,杰