Red border around TextBox when validation fails

Posted by hungster on Stack Overflow See other posts from Stack Overflow or by hungster
Published on 2010-05-13T21:25:57Z Indexed on 2010/05/13 23:14 UTC
Read the original article Hit count: 283

Filed under:
|

I am using ASP.NET MVC 2.

Html.DropDownListFor and Html.TextAreaFor automatically get red borders when the validation fails.

How to make the four borders of a TextBox (using Html.TextBoxFor) red when it fails validation?

For example, I have a TextBox that is required and when the user submits the form without specifying a value in the textbox, I want the textbox to have red borders.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about validation