验证错误时改回原色 [英] on validation error change back color

查看:88
本文介绍了验证错误时改回原色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

单击提交按钮后,如果任何验证失败,如何更改控件的边框和背景颜色.
我在Google中进行了搜索,但是jQuery提供了大多数解决方案,但我不想使用jQuery.

How can I change border and background color of the control when any of the validation fails after submit button clicked.
I searched this in google but most of the solution provided in jQuery, but I don''t want to use jQuery.

推荐答案

在按钮上单击,尝试类似的操作这个

{

如果(TextBox1.Text == Null || TextBox1.Text =")
{
TextBox1.BackColor = System.Drawing.Color.Red;
}
On button Click, try some thing like this

{

if (TextBox1.Text==Null|| TextBox1.Text="")
{
TextBox1.BackColor = System.Drawing.Color.Red;
}


这篇关于验证错误时改回原色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆