开发者

Html.TextBoxFor change color value if error at login

开发者 https://www.devze.com 2023-04-06 16:42 出处:网络
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 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; }

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号