BUTTON1中调用BUTTON2

来源:百度知道 编辑:UC知道 时间:2024/05/22 18:35:42
我将Button3变成了弹出框 Button3.Attributes.Add("onclick", "javascript:return window.alert('用户名活密码为空!')");

在点击button1后如果条件成立我想执行button3,不知道行不行》?
protected void Button1_Click(object sender, EventArgs e)
{
string Uname = UserName.Text.ToString();

if(Uname!=null)
{
if(Uname==null||Uname.Length==0)
{
?????
}
}
}

你可以把你想弹出来的内容放在一个函数里面
这样就不用把你的按钮3设置成一个弹出式的方式了
那样的话你在按钮1中想执行的内容就直接调用一下
你所写的函数就可以了

JS就在前台 判断 ,后台 判断 就用 response.write("<script>alert()</script>")