/// <summary> /// 在页面中,弹出消息提示对话框 用在updatepanel中, /// </summary> /// <param name="page">页面</param> /// <param name="message">提示信息</param> public static void ShowDialogAjax(System.Web.UI.Page page, string message) { ScriptManager.RegisterStartupScript(page, page.GetType(), "", "alert('" + StringDealwith.StringFormat(message) + "');", true); }
/// <summary> /// 在页面中,弹出消息提示对话框 用在updatepanel中,同时可以刷新当前页面或者跳转到其他页面 /// </summary> /// <param name="page">页面</param> /// <param name="message">提示信息</param> /// <param name="redirect">空(不跳转); Refresh(刷新);其他(跳转到传入的页面)</param> public static void ShowDialogAjax(System.Web.UI.Page page, string message, string redirect) { if (redirect == "") { ScriptManager.RegisterStartupScript(page, page.GetType(), "", "alert('" + StringDealwith.StringFormat(message) + "');", true); } else if (redirect == "Refresh") { ScriptManager.RegisterStartupScript(page, page.GetType(), "", "alert('" + StringDealwith.StringFormat(message) + "');self.location='" + System.IO.Path.GetFileName(page.Request.PhysicalPath) + "';", true); } else { ScriptManager.RegisterStartupScript(page, page.GetType(), "", "alert('" + StringDealwith.StringFormat(message) + "');self.location='" + redirect + "';", true); } }
/// <summary> /// 在页面中,弹出消息提示对话框 /// </summary> /// <param name="page">页面</param> /// <param name="message">提示信息</param> public static void ShowDialog(System.Web.UI.Page page, string message) { page.ClientScript.RegisterStartupScript(page.GetType(), "message", "<script language='javascript' defer>alert('" + StringDealwith.StringFormat(message) + "');</script>"); }