/// <summary> /// 通过ScriptManager.RegisterClientScriptBlock注册客户端错误信息的脚本 /// </summary> /// <param name="strMessage"></param> /// <param name="strDetail"></param> /// <param name="strTitle"></param> public static void RegisterClientErrorMessage(string strMessage, string strDetail, string strTitle) { Page page = GetCurrentPage(); WebApplicationExceptionExtension.TryWriteAppLog(strMessage, strDetail); ScriptManager.RegisterStartupScript(page, typeof(WebUtility), "ClientMsg", string.Format("$HGRootNS.ClientMsg.stop(\"{0}\", \"{1}\", \"{2}\");", CheckScriptString(strMessage), CheckScriptString(strDetail), CheckScriptString(strTitle)), true); }
/// <summary> /// Response客户端弹出错误框 /// </summary> /// <param name="strMessage">错误框消息</param> /// <param name="strDetail">错误框详细信息</param> /// <param name="strTitle">错误框Title</param> public static void ResponseShowClientErrorScriptBlock(string strMessage, string strDetail, string strTitle) { ResponseClientMessageCommonScriptBlock(); if (AllowResponseExceptionStackTrace() == false) { strDetail = string.Empty; } string script = string.Format("$HGRootNS.ClientMsg.stop(\"{0}\", \"{1}\", \"{2}\");", CheckScriptString(strMessage), CheckScriptString(strDetail), CheckScriptString(strTitle)); script = DeluxeClientScriptManager.AddScriptTags(script); WebApplicationExceptionExtension.TryWriteAppLog(strMessage, strDetail); HttpContext.Current.Response.Write(script); }
/// <summary> /// 客户端弹出错误框 /// </summary> /// <param name="strMessage">错误框消息</param> /// <param name="strDetail">错误框详细信息</param> /// <param name="strTitle">错误框Title</param> public static void ShowClientError(string strMessage, string strDetail, string strTitle) { Page page = GetCurrentPage(); if (AllowResponseExceptionStackTrace() == false) { strDetail = string.Empty; } WebApplicationExceptionExtension.TryWriteAppLog(strMessage, strDetail); RegisterClientMessageScript(page); RegisterOnLoadScriptBlock(page, string.Format("$HGRootNS.ClientMsg.stop(\"{0}\", \"{1}\", \"{2}\");", CheckScriptString(strMessage), CheckScriptString(strDetail), CheckScriptString(strTitle))); WebApplicationExceptionExtension.TryWriteAppLog(strMessage, strDetail); }