protected override void RenderContents(HtmlTextWriter writer) { EvaluateWaiConformity(); if (IsLegacyButtonEnabled) { return; } //For new styles //if (ControlHelper.IsDesignMode (this)) // return; ScriptUtility.Instance.RegisterElementForBorderSpans(this, "#" + ClientID + " > *:first"); writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClassButtonBody); writer.RenderBeginTag(HtmlTextWriterTag.Span); var text = HotkeyFormatter.FormatText(_textWithHotkey, false); if (HasControls()) { base.RenderContents(writer); } else { bool hasIcon = _icon != null && _icon.HasRenderingInformation; bool hasText = !string.IsNullOrEmpty(text); if (hasIcon) { writer.AddAttribute(HtmlTextWriterAttribute.Src, _icon.Url); if (!_icon.Height.IsEmpty) { writer.AddAttribute(HtmlTextWriterAttribute.Height, _icon.Height.ToString()); } if (!_icon.Width.IsEmpty) { writer.AddAttribute(HtmlTextWriterAttribute.Width, _icon.Width.ToString()); } writer.AddStyleAttribute("vertical-align", "middle"); writer.AddStyleAttribute(HtmlTextWriterStyle.BorderStyle, "none"); writer.AddAttribute(HtmlTextWriterAttribute.Alt, _icon.AlternateText); writer.RenderBeginTag(HtmlTextWriterTag.Img); writer.RenderEndTag(); } if (hasIcon && hasText) { writer.Write(" "); } if (hasText) { writer.Write(text); // Do not HTML enocde } } writer.RenderEndTag(); // End acnhorBody span }
protected override void RenderContents(HtmlTextWriter writer) { if (WcagHelper.Instance.IsWcagDebuggingEnabled() && WcagHelper.Instance.IsWaiConformanceLevelARequired()) { WcagHelper.Instance.HandleError(1, this); } if (HasControls()) { base.RenderContents(writer); } else { writer.Write(HotkeyFormatter.FormatText(_textWithHotkey, false)); } }