一个登录页面,有个按钮,点击它弹出对话框,如果点对话框上的确定按钮,要执行登录页面上的一个按钮事件!如果点取消则不执行,请问各位高手能否给一个答案!小弟十感谢谢!!!!
private void Page_Load(object sender, System.EventArgs e)
 {
   button.Attributes.Add("onclick", "JavaScript:return confirm('确定要退出系统吗?');");
}private void button_Click(object sender, System.EventArgs e)
{
  UIServiceSystem.TbSysUser Item = new EisWebSite.UIServiceSystem.TbSysUser();
  Item.OnLine='0';
  Item.SQLEx = "AND Tb_Sys_User.UserCode='"+Request.Cookies["UserCode"].Value+"'";
  AppGlobal.AppServiceSystem.UserUpdate(Item);
}

解决方案 »

  1.   

    我写过一个简单的例子: 
      public  void ShowMessage(string MessageInfo) 
            { 
              
                HttpContext.Current.Response.Write(" <script language=javascript>alert('" + MessageInfo + "') </script>"); 
            }         public void showMessRedirect(string Mess,string UrlName) 
            {             HttpContext.Current.Response.Write(" <script language=javascript>alert('" + Mess + "');window.location='" + UrlName + "'; </script>"); 
            } 把他们放进一个类里面: 
    如A.DB 
    声明:A a=new A(); 
    a.ShowMessage("你要显示的语句"); 最后:有个请求,请给我多一点分.我最近的分数,不知道为什么少很多,可能是下载东西多啦吧.
      

  2.   

    form1.aspx<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    </head>
    <script>
        function ShowForm()
        {
            var isOk=false;
            isOk=window.showModalDialog("webForm1.aspx");
            if(isOk)
            {
                alert("123");
            }
        }
    </script>
    <body>
        <form id="form1" runat="server">
        <div>
           <input type="button" value="打开窗口" onclick="ShowForm()" />
        </div>
        </form>
    </body>
    </html>form2.aspx<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <script>
                var isClose=false;
                isClose=confirm("退出系统");            
                window.returnValue=isClose
                if(isClose)
                {
                    self.close();
                }
            </script>
        </div>
        </form>
    </body>
    </html>