1
我创建了一个视图,它创建了一个模型。型号有枚举领域,像这样:.net核心传递枚举查看
public ProjectType ProjectType { get; set; }
public enum ProjectType : int
{
type1= 1,
type2 = 2,
type3 = 3,
other = 4
}
,并考虑,我展示它是这样的:
<div class="form-group">
@Html.LabelFor(m => m.ProjectType, new { @class = "col-md-2 control-label" })
<div class="col-md-10">
@Html.DropDownListFor(m => m.ProjectType,Model.ProjectType, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.ProjectType)
</div>
</div>
我,'M试图达到这个观点,我得到一个错误:
There is no argument given that corresponds to the required formal parameter 'htmlAttributes' of
'IHtmlHelper<Project>.DropDownListFor<TResult>(Expression<Func<Project, TResult>>, IEnumerable<SelectListItem>, string, object)'
我试图解决这个问题,通过创建HTML的帮手,但我需要使用System.Web.Mvc,但我可以”塔德成.NET的核心项目 是否有任何其他的解决方案呢?