记得先 using
using System.Web.UI;
1 public void Alert(string str_Message)
2 {
3 ClientScriptManager scriptManager =((Page)System.Web.HttpContext.Current.Handler).ClientScript;
4 scriptManager.RegisterStartupScript(typeof(string), "", "alert('" + str_Message + "');", true);
5 }
6 public void Alert(string str_Message, string redirect)
7 {
8 ClientScriptManager scriptManager =((Page)System.Web.HttpContext.Current.Handler).ClientScript;
9 scriptManager.RegisterStartupScript(typeof(string), "", "alert('" + str_Message + "');self.location='"+redirect+"'", true);
10 }
11
12