C# Web开发中弹出对话框的函数[转载]

记得先  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  
原文地址:https://www.cnblogs.com/mic86/p/1779921.html