Button1.Attributes.Add("onclick", "return confirm('真的要删除吗?');");

解决方案 »

  1.   

    System.Web.HttpContext.Current.Response.Write
      

  2.   

    自定义类里好象无法添加System.Web.HttpContext.Current.Response.Write
      

  3.   

    http://expert.csdn.net/Expert/topic/2599/2599724.xml?temp=4.410952E-02
      

  4.   

    我试过了可是还是出现异常:异常详细信息: System.Web.HttpException: 响应在此上下文中不可用。源错误: 
    行 23:  sb.Append(tempstr).Append("\");");
    行 24:  sb.Append("<").Append("/").Append("script>");
    行 25:  Response.Write(sb.ToString());
    行 26:  }
    行 27: 
     源文件: e:\inetpub\wwwroot\mxltcs\common\data\outlayruledata.cs    行: 25 
      

  5.   

    你是写在类库里面的吧?
    首先在vs.net的引用里面添加System.Web.dll引用,然后在你的outlayruledata.cs文件的上面加入using System.Web;代码,然后Response这样写
    HttpContext.Current.Response.Output.Write("<script>alert('请填入正确的信息');history.go(-1)</script>");
    HttpContext.Current.Response.End();
      

  6.   

    这样就OK了
    Response.Write("<SCRIPT LANGUAGE=""JavaScript"">alert(""文件不存在,请重新加载"")</script>")