ASP.NET MVC CSS Templates for HTML.Controls

I think I'm missing something relatively simple here, but I'm trying to find a way to apply the CSS class to my controls in my views. I use

<%= Html.SubmitButton("Submit", "Edit Plot")%>

style method for this. If you do not use separators around these elements and apply style, is there a way to access the CssClass property, which will be available in normal .NET?

+4
source share
1 answer

Check out http://blog.veggerby.dk/2008/11/19/aspnet-mvc-htmlhelper-methods-and-css-class/ , it's simple:

 <% = Html.TextBox("name", null, new{ @class = "required"}) %> 
+9
source

All Articles