0
'在我的MVC项目中运行时,我在当时按下编辑选项,错误发生具有'distic_id'键的ViewData项的类型为'System.Int32',但必须为'IEnumerable <SelectListItem>''
具有关键 'distic_id' 的类型为 'System.Int32',但必须是类型 '的IEnumerable <SelectListItem>'
在我看来代码ViewData的项目
@Html.DropDownListFor(m => m.distic_id, Model.disticlist)
模型
public class city
{
public List<SelectListItem> disticlist { get; set; }
public int city_id { get; set; }
[Required]
[Display(Name = "enter the District name")]
public string city_name { get; set; }
[Required]
[Display(Name = "select district ")]
public int distic_id { get; set; }
}
那么,如果编译器正确,请检查您的模型。我想是的。 – nvoigt
发布您的模型类型。 –
一些重播我 –