Beispiel #1
0
 public static void TipMsg(System.Web.UI.Page page, string Msg = "", int TimeOut = 1000, SysEnum.MsgType MsgType = SysEnum.MsgType.SUCCESS)
 {
     if (string.IsNullOrEmpty(Msg))
     {
         return;
     }
     else
     {
         Msg = Msg.Replace('\'', '"');
         StringBuilder sbAlert = new StringBuilder();
         sbAlert.Append("<script  type='text/javascript'>");
         sbAlert.Append(" jQuery(document).ready(function () {");
         sbAlert.Append(" showTipsMsg('" + Msg + "','" + TimeOut + "','" + Convert.ToInt32(MsgType) + "');");
         sbAlert.Append("});");
         sbAlert.Append("</script>");
         if (!page.ClientScript.IsStartupScriptRegistered(page.GetType(), "alert"))
         {
             page.ClientScript.RegisterStartupScript(page.GetType(), "alert", sbAlert.ToString());
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 关闭Window,顶部提示消息
        /// </summary>
        /// <param name="page"></param>
        /// <param name="Msg"></param>
        public static void CloseWindow(System.Web.UI.Page page, string Msg = "", int TimeOut = 1000, SysEnum.MsgType MsgType = SysEnum.MsgType.SUCCESS)
        {
            StringBuilder sbAlert = new StringBuilder();

            sbAlert.Append("<script  type='text/javascript'>");
            sbAlert.Append(" jQuery(document).ready(function () {");
            sbAlert.Append(" showTipsMsg('" + Msg + "','" + TimeOut + "','" + Convert.ToInt32(MsgType) + "');");
            sbAlert.Append(" RefreshCenter(); OpenClose();");
            sbAlert.Append("});");
            sbAlert.Append("</script>");
            if (!page.ClientScript.IsStartupScriptRegistered(page.GetType(), "alert"))
            {
                page.ClientScript.RegisterStartupScript(page.GetType(), "alert", sbAlert.ToString());
            }
        }