How can I apply styling to asp.net mvc @Html.TextboxFor?

Viewed 101959

I want to change the background of the textbox. This is my code:

@Html.TextBoxFor(p => p.Publishers[0].pub_name)

What more do I need to write in TextBoxFor to change the background?

3 Answers

Now you can add html attributes like this:

 @Html.EditorFor(p => p.Publishers[0].pub_name, new { htmlAttributes = new { @class = 
 "YourBackgroundClass" } })
Related