/// <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; } Literal LiBreadcrumb = FindControl("LiBreadcrumb") as Literal; if (LiBreadcrumb != null) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(" <ol class=\"breadcrumb\">").AppendLine(); sb.Append(" <li>").AppendLine(); sb.Append(" <i class=\"fa clip-leaf\"></i>").AppendLine(); sb.AppendFormat(" <a href=\"{1}\">{0}</a>", Settings_EffectName, xUrl("Effect_List")).AppendLine(); sb.Append(" </li>").AppendLine(); sb.AppendFormat(" <li class=\"active\"><a href=\"{1}\">{0}</a></li>", Settings_EffectThemeName, xUrl("Effect_Options")).AppendLine(); sb.Append(" </ol>").AppendLine(); LiBreadcrumb.Text = sb.ToString(); } }
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); }