I'm using ASP.NET MVC 2 and using Microsoft's beautiful new 'DataAnnotations' to provide some validation hints for my model.
I can get the validation messages to display... but here's the rub: I'd like to add a CSS class to a specific div when there is a validation error involving a specific field.
I figure I can brute force this by checking to see if the <%: Html.ValidationMessageFor(m=>m.MyModelFieldname) %>
is empty in the view code markup ... but the amount of bulk that would add to the markup gives me the willies.
Is there an easier or more elegant way to do this?