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

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);
}


posted @ 2010-10-27 19:45  小锋神  阅读(703)  评论(0编辑  收藏  举报