DropDownListFor 重载 htmlAttributes
DropDownListFor overload htmlAttributes
如何使用此重载添加 htmlAttributes
:
我正在使用以下重载:
@Html.DropDownListFor(model => item.Type.Value, new SelectList(ViewBag.DropDownLoadRecoveryType, "Value", "Text", item.Type))
我想将 htmlattributes
添加到上面的重载中,但我没有看到任何支持的重载,除非我遗漏了什么。
new { @class = "form-control" })
DropDownListFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, IEnumerable<SelectListItem>, Object)
@Html.DropDownListFor(model => item.Type.Value,
new SelectList(ViewBag.DropDownLoadRecoveryType, "Value", "Text", item.Type),
new { @class = "form-control" })
如何使用此重载添加 htmlAttributes
:
我正在使用以下重载:
@Html.DropDownListFor(model => item.Type.Value, new SelectList(ViewBag.DropDownLoadRecoveryType, "Value", "Text", item.Type))
我想将 htmlattributes
添加到上面的重载中,但我没有看到任何支持的重载,除非我遗漏了什么。
new { @class = "form-control" })
DropDownListFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, IEnumerable<SelectListItem>, Object)
@Html.DropDownListFor(model => item.Type.Value,
new SelectList(ViewBag.DropDownLoadRecoveryType, "Value", "Text", item.Type),
new { @class = "form-control" })