通过button事件判断textbox1和2是否为空,但我输入了用户名和密码也执行if语句,Label1和2仍然显示,求解
protected void Button2_Click(object sender, EventArgs e)
{ if (TextBox1.Text == "")
{
Label1.Text = "用户名不能为空";
} if (TextBox2.Text== "")
{
Label2.Text = "密码不能为空";
} }
protected void Button2_Click(object sender, EventArgs e)
{ if (TextBox1.Text == "")
{
Label1.Text = "用户名不能为空";
} if (TextBox2.Text== "")
{
Label2.Text = "密码不能为空";
} }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货