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

时间:2021-06-25 23:41:26

public void Alert(string str_Message)
{
ClientScriptManager scriptManager =((Page)System.Web.HttpContext.Current.Handler).ClientScript;
scriptManager.RegisterStartupScript(typeof(string), "", "alert('" + str_Message + "');", true);
}
public void Alert(string str_Message, string redirect)
{
ClientScriptManager scriptManager =((Page)System.Web.HttpContext.Current.Handler).ClientScript;
scriptManager.RegisterStartupScript(typeof(string), "", "alert('" + str_Message + "');self.location='"+redirect+"'", true);
}