Reputation: 2425
@Html.DropDownList(productOption.Option.Id.ToString(), productOption.ValuesInOptions.ToSelectList(f => f.OptionValue.OptionValue1,
f => f.Id.ToString(),
"Select"));
How would I add a class to the above @Html.DropDownlist() within a razor view?
Upvotes: 0
Views: 994
Reputation: 12334
You can use it's overload, that accepts providing html attributes:
@Html.DropDownList(productOption.Option.Id.ToString(), productOption.ValuesInOptions.ToSelectList(f => f.OptionValue.OptionValue1,
f => f.Id.ToString(),
"Select"), new {@class = "some-class"});
Upvotes: 3