/// <summary> /// WebControl(UpdatePanel)中执行js脚本 /// </summary> /// <param name="webControl"></param> /// <param name="scriptText"></param> /// <param name="isAddScriptTag">是否添加ScriptTag</param> public static void RegisterAjaxJS(System.Web.UI.WebControls.WebControl webControl, string scriptText, bool isAddScriptTag) { ScriptManager.RegisterStartupScript(webControl, webControl.GetType(), "msg", scriptText, isAddScriptTag); }
/// <summary> /// 显示消息提示对话框 /// </summary> /// <param name="page">当前页面指针,一般为this</param> /// <param name="msg">提示信息</param> public static void Show(System.Web.UI.WebControls.WebControl Control, string msg) { System.Web.UI.Page page; page = System.Web.HttpContext.Current.Handler as System.Web.UI.Page; page.ClientScript.RegisterStartupScript(Control.GetType(), "message", "<script language=\"javascript\" defer>alert(\"" + msg.ToString() + "\");</script>"); }