ASP.NET ALERT訊息公版

ASP.NET ALERT訊息公版

如下:

  public void MsgBox(String ex, Page pg, Object obj)
    {
        string s = "<SCRIPT language='javascript'>alert('" + ex.Replace("\r\n", "\\n").Replace("'", "") + "'); </SCRIPT>";
        Type cstype = obj.GetType();
        ClientScriptManager cs = pg.ClientScript;
        cs.RegisterClientScriptBlock(cstype, s, s.ToString());
    }

call:

 MsgBox(" 已更新", this.Page, this);

 

自我LV~