注:我的网页上没有任何按钮,是按条件来判断的。
---------------------------------如果 A=1 那么弹出对话框“确定”“取消”,如果用户点了“确定”那么执行 BBB 程序,如果点了“取消”那么执行 CCC 程序。

解决方案 »

  1.   

    if(A == 1)
            {            // Initializes the variables to pass to the MessageBox.Show method.            string message = "You will run BBB?";
                string caption = "Choose";
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                DialogResult result;            // Displays the MessageBox.            result = MessageBox.Show(this, message, caption, buttons,
                    MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, 
                    MessageBoxOptions.RightAlign);            if(result == DialogResult.Yes)
                {
                    Application.Start("BBB.exe");
                }
                else
                {
                    Application.Start("CCC.exe");
                }        }
      

  2.   

    错了错了,没有看清是Webform的
      

  3.   

    if (A=1)
    {
        Response.Write("<script>if (window.confirm(\"确定去B,取消去C\")) {window.location=\"bbb.aspx\";}else {window.location=\"ccc.aspx\";}</script>")
    }
      

  4.   

    你为什么要在Web中Win的对话框呢?
    在Web中引用System.Windows.Form后用1楼的方法就可以用MessageBox了
    但是客户端是不会有反应的!
      

  5.   

    azev(阿则) 的办法不错。可是要多做一个页面啊。
      

  6.   

    我试过了MessageBox,客户端一点反应都没有。
      

  7.   

    http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/showmodaldialog.asp
      

  8.   

    BS模式就是这样的啦。。用azev(阿则)的方法。。多做个页面也不麻烦嘛
      

  9.   

    这个比较象你的要求
    http://community.csdn.net/Expert/topic/2648/2648410.xml?temp=.8752558
      

  10.   

    又个思路在后台pageload的时候 
    根据A是否等于1
    将页面上的一个元素赋值然后在页面body的最后(或是onload中?)执行一个js函数
    该函数判断页面上那个元素的值
    然后来调用不同的后台代码
    如:
    ////////////////
    function Del(fullname)
    {
    if (confirm('确认删除?'))
    {
    document.forms['nethard'].elements['HdnFuncParam'].value=fullname;
    __doPostBack('LbnDel','');
    }
    }
    /////////////////关键
    在前面页面你要放两个按钮来分别执行后台的两段代码(如上面的LbnDel)
    然后用客户端js代码来启动两个按钮对应的后台代码