WebForm没有MessageBox
try
Response.Write("<script>alert('You must enter a name.');</script>");

解决方案 »

  1.   

    sub click(sender as object,e as system.eventargs)
      Response.Write("<script>alert('You must enter a name.');history.back();</script>")
               Response.end
              end sub
      

  2.   

    cnhgj(戏子 ■ 学习C++) 的方法试过了
    提示说: “字符串常数必须以双引号结束”
      

  3.   

    通过输出客户端脚本(js)实现,
    Response.Write("<script>alert('....');</script>")
      

  4.   

    Response.Write("<script>alert('You must enter a name.');history.back();</" & "script>")
      

  5.   

    也可以这样用,但是要添加命名空间的应用
    好像是imports system.windows.forms(好像)
    然后就可以用了,但是这样的话,所以的客户端的错误也在服务器端弹出,所以建议不用
    而改用javascript的弹出按钮
      

  6.   

    不是吧。Web页中也能imports system.windows.forms??
      

  7.   

    to :GalfordLiu(喜欢汪峰的歌)
    当然可以,楼主的代码不太对
    应该为 MessageBox.Show("mywin","haha",MessageBoxButtons.OK , System.Windows.Forms.MessageBoxIcon.Hand , System.Windows.Forms.MessageBoxDefaultButton.Button1 , System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly );
    只是这将在服务器端弹出
      

  8.   

    Asp.Net中根本没有MessageBox() , 请你使用...
    Response.Write("<script>alert('....');</script>")来替代
      

  9.   

    response.write("<script>alert('test')</"& "/script>")
      

  10.   

    你怎么在asp.net中使用<%@ Import namespace="System.Windows.Forms" %>?呵呵,这是vs.net windows程序用的,不是asp.net用的。
    ====================================
    另外,msgbox()不能在asp.net中应用,我曾经是过,程序代码没有问题,系统提示的具体说法我记不太清了,大意是:msgbox()不能应用于asp.net环境,浏览器无法启动msgbox()响应事件。
      

  11.   

    在Page_OnLoad中加入
    Button1.Attributes["onclick"]="javascript:alert('test')"
    仅供参考
      

  12.   

    asp.net可以用MessageBox,只是你没加参数System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly ,或者没有引用System.window.forms库,
    当然弹出窗口是在服务器端,客户端无法看见,
      

  13.   

    用ALERT吧,网页中没桌面程序那么方便