How to set css class of TextBox in Razor MVC
08 May 2014, 05:17 AM
You can pass the html attributes values in dictionary in key value pair.
@Html.TextBoxFor(m => m.UserName, new Dictionary() { { "class", "water" } })
In the above example “Class” is the name of attribute and “water” is the value.