EnumDropDownList当模型是IEnumerable时不解析

时间:2014-08-25 19:33:52

标签: asp.net-mvc-5

我尝试使用Html.EnumDropDownFor(model => model.Gender),这只适用于模型Project.Models.Performer,但不适用于IEnumerable<Project.Models.Performer>

在Visual Studio中,我收到以下错误:

"The type arguments for method Html.SelectExtensions.EnumDropDownLostFor<TModel, TEnum>(...) cannot be inferred from the usage. Try specifying the the arguments explicitly"

在浏览器中我得到:

"CS1061: 'System.Collections.Generic.IEnumerable<Project.Models.Performer>' does not contain a definition for 'Gender' and no extension method 'Gender' accepting a first argument of type 'System.Collections.Generic.IEnumerable<Project.Models.Performer>' could be found (are you missing a using directive or an assembly reference?)"

Gender是我在Performer的文件中定义的枚举。

0 个答案:

没有答案