4

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?

1 Answer 1

9

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"})  %>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.