Probably a simple question, but i cant seem to find the answer.
using MVC 2 i have a series of Html.ValidationFor controls. I want to assign a CSS class to the text and cant seem to do it.
<%= Html.TextBoxFor(Model => Model.Chest, new { @class = "textBoxMeasure" })%>
<%= Html.ValidationMessageFor(Model => Model.Chest) %>
if i try the same method as textboxfor i get errors because it requires a string, when i put a string in it still wont work!
thanks
There’s a variant that takes htmlAttributes as the third argument (the second is the message that should be displayed, or you can use null for the default validation message)
For more info see http://msdn.microsoft.com/en-us/library/ee721293%28v=vs.98%29.aspx