private void AssertItem(XmlNode item, IWebTab webTab, bool isLastItem, bool isDesignMode) { if (isDesignMode) { item.AssertStyleAttribute("float", "left"); item.AssertStyleAttribute("display", "block"); item.AssertStyleAttribute("white-space", "nowrap"); } item.AssertChildElementCount(isLastItem ? 2 : 1); var wrapper = item.GetAssertedChildElement("span", 0); wrapper.AssertAttributeValueEquals("class", _renderer.CssClassTabWrapper); var separator = wrapper.GetAssertedChildElement("span", 0); separator.AssertAttributeValueEquals("class", _renderer.CssClassSeparator); separator.AssertChildElementCount(1); var empty = separator.GetAssertedChildElement("span", 0); empty.AssertChildElementCount(0); var tab = wrapper.GetAssertedChildElement("span", 1); tab.AssertAttributeValueEquals("id", _webTabStrip.ClientID + "_" + webTab.ItemID); tab.AssertAttributeValueContains("class", webTab.IsSelected ? _renderer.CssClassTabSelected : _renderer.CssClassTab); if (!webTab.EvaluateEnabled()) { tab.AssertAttributeValueContains("class", _renderer.CssClassDisabled); } var link = tab.GetAssertedChildElement("a", 0); bool isDisabledBySelection = webTab.IsSelected && !_webTabStrip.EnableSelectedTab; if (webTab.EvaluateEnabled()) { link.AssertAttributeValueEquals("href", "#"); } if (webTab.EvaluateEnabled() && !isDisabledBySelection) { string clickScript = _pageStub.ClientScript.GetPostBackClientHyperlink(_webTabStrip, webTab.ItemID); link.AssertAttributeValueEquals("onclick", clickScript); } AssertAnchor(link, webTab); }
private void RenderWrapperBegin(WebTabStripRenderingContext renderingContext, IWebTab tab) { renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Id, GetTabClientID(renderingContext, tab)); string cssClass; if (tab.IsSelected) { cssClass = CssClassTabSelected; } else { cssClass = CssClassTab; } if (!tab.EvaluateEnabled()) { cssClass += " " + CssClassDisabled; } renderingContext.Writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass); if (RenderingFeatures.EnableDiagnosticMetadata) { if (!string.IsNullOrEmpty(tab.ItemID)) { renderingContext.Writer.AddAttribute(DiagnosticMetadataAttributes.ItemID, tab.ItemID); } if (!string.IsNullOrEmpty(tab.Text)) { renderingContext.Writer.AddAttribute(DiagnosticMetadataAttributes.Content, HtmlUtility.StripHtmlTags(tab.Text)); } } renderingContext.Writer.RenderBeginTag(HtmlTextWriterTag.Span); // Begin tab span }
protected virtual Command RenderBeginTagForCommand(WebTabStripRenderingContext renderingContext, IWebTab tab, bool isEnabled, WebTabStyle style) { ArgumentUtility.CheckNotNull("renderingContext", renderingContext); ArgumentUtility.CheckNotNull("style", style); var command = new Command(); command.OwnerControl = renderingContext.Control; command.ItemID = tab.ItemID + "_Command"; if (isEnabled && tab.EvaluateEnabled()) { command.Type = CommandType.Event; var textWithHotkey = HotkeyParser.Parse(tab.Text); if (textWithHotkey.Hotkey.HasValue) { command.AccessKey = _hotkeyFormatter.FormatHotkey(textWithHotkey); } } else { command.Type = CommandType.None; } command.RenderBegin( renderingContext.Writer, RenderingFeatures, tab.GetPostBackClientEvent(), new string[0], string.Empty, null, new NameValueCollection(), false, style); return(command); }