/// <summary> /// 向页面注册提示信息 /// </summary> public String Post(Page p) { if (HttpContext.Current.Session[SessionName()] != null) { String s = Convert.ToString(HttpContext.Current.Session[SessionName()]); if (!String.IsNullOrEmpty(s)) { MessageTips mt = ConvertTo.Deserialize <MessageTips>(s); if (mt != null && (mt.IsPostBack || !p.IsPostBack)) { HttpContext.Current.Session.Remove(SessionName()); this._Content = mt.Content; this._MsgType = mt.MsgType; this._GoUrl = mt.GoUrl; } } } if (!String.IsNullOrEmpty(_Content)) { //System.Text.StringBuilder sb = new System.Text.StringBuilder(); //sb.Append("<script type=\"text/javascript\">"); //sb.AppendFormat("asyncbox.tips('{0}','{1}');", _Content, EnumHelper.GetEnumTextVal((Int32)_MsgType, typeof(EnumTips))); //sb.Append("</script>"); //Pmb.Page.RegisterStartupScript("asyncbox.tips", sb.ToString()); } return(_Content); }
protected void Page_PreRender(object sender, EventArgs e) { MessageTips mt = new MessageTips(); lblMessage.Text = mt.PostHtml(this); if (!String.IsNullOrEmpty(lblMessage.Text)) { lblMessage.Visible = true; } else { lblMessage.Visible = false; } //加载皮肤插件使用的面包屑功能 if (("Skins,Skin_Options,Skin_NewSkin,Skin_Settings").IndexOf(Token, StringComparison.CurrentCultureIgnoreCase) >= 0) { //加载 LoadSkinBreadcrumb(); } else if (("Global_Options").IndexOf(Token, StringComparison.CurrentCultureIgnoreCase) >= 0) { //加载 LoadSkinBreadcrumbOnlySkin(); } }
public String PostHtml(Page p) { if (HttpContext.Current.Session[SessionName()] != null) { String s = Convert.ToString(HttpContext.Current.Session[SessionName()]); if (!String.IsNullOrEmpty(s)) { MessageTips mt = ConvertTo.Deserialize <MessageTips>(s); if (mt != null && (mt.IsPostBack || !p.IsPostBack)) { HttpContext.Current.Session.Remove(SessionName()); this._Content = mt.Content; this._MsgType = mt.MsgType; this._GoUrl = mt.GoUrl; } } } if (!String.IsNullOrEmpty(_Content)) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (MsgType == EnumTips.Alert) { sb.Append("<div class=\"alert alert-info\">").AppendLine(); sb.Append("<button data-dismiss=\"alert\" class=\"close\">×</button>").AppendLine(); sb.AppendFormat("<i class=\"fa fa-info-circle\"></i> {0}", _Content).AppendLine(); sb.Append("</div>").AppendLine(); } else if (MsgType == EnumTips.Error) { sb.Append("<div class=\"alert alert-danger\">").AppendLine(); sb.Append("<button data-dismiss=\"alert\" class=\"close\">×</button>").AppendLine(); sb.AppendFormat("<i class=\"fa fa-times-circle\"></i> {0}", _Content).AppendLine(); sb.Append("</div>").AppendLine(); } else if (MsgType == EnumTips.Warning) { sb.Append("<div class=\"alert alert-warning\">").AppendLine(); sb.Append("<button data-dismiss=\"alert\" class=\"close\">×</button>").AppendLine(); sb.AppendFormat("<i class=\"fa fa-exclamation-triangle\"></i> {0}", _Content).AppendLine(); sb.Append("</div>").AppendLine(); } else if (MsgType == EnumTips.Success) { sb.Append("<div class=\"alert alert-success\">").AppendLine(); sb.Append("<button data-dismiss=\"alert\" class=\"close\">×</button>").AppendLine(); sb.AppendFormat("<i class=\"fa fa-check-circle\"></i> {0}", _Content).AppendLine(); sb.Append("</div>").AppendLine(); } return(sb.ToString()); } return(_Content); }