1

I am new to mvc and I wonder how I can change the background color if the User do@html.TextBoxFor enter the wrong login. I'm using it quite simply.

@Html.TextBoxFor(m => m.Email, new {@class="caixa_login_email" })

How could add a new value for background color?

4

1 回答 1

0

If you have a [Required] attribute on the Email property, when the posted ModelState is invalid, the TextBox will have a class added to it like '.input-validation-error'

You could add a css style to change the background color:

.input-validation-error { background-color: #000; }

于 2011-11-15T02:39:08.740 回答