根据条件判断,弹出对话框 (确认,取消)

 
protected Button1_Click(object sender, EventArgs e)
{
    if(某些条件)
    {
        this.ClientScript.RegisterStartupScript(typeof(string),"js","if(confirm('确定吗?')){document.getElementById('"+Button2.ClientID+"').click();}else{document.getElementById('"+
Button3.ClientID +"').click();}",true);
    }
}
protected Button2_Click(object sender, EventArgs e)
{
     this.ClientScript.RegisterStartupScript(typeof(string),"yes","alert('你选择了是');"true);
}
protected Button3_Click(object sender, EventArgs e)
{
    this.ClientScript.RegisterStartupScript(typeof(string),"no","alert('你选择了否');"true);
}


                            

你可能感兴趣的:(对话框)