Reputation: 20078
How do I add htmlAttributes
using this overload:
I'm using the below overload:
@Html.DropDownListFor(model => item.Type.Value, new SelectList(ViewBag.DropDownLoadRecoveryType, "Value", "Text", item.Type))
I like to add htmlattributes
to the above overload and i do not see any overloads that support unless I'm missing something.
new { @class = "form-control" })
Upvotes: 1
Views: 6397
Reputation: 11971
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" })
Upvotes: 3