Html.TextBoxFor change color value if error at login
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 backgro开发者_开发百科und color?
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; }
精彩评论