views:

866

answers:

1

I think I'm missing something relatively simple here, but I'm trying to find a way of applying a CSS class to my controls within my views. I'm using the

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

style method of doing this. Short of putting divs around these elements and applying the styling, is there anyone way of getting access to the CssClass property that would be available in normal .Net?

+7  A: 

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

<% = Html.TextBox("name", null, new{ @class = "required"})  %>
veggerby
Spot on. Exactly what I needed. Many thanks!
Chops