/// <summary> /// Overriden. Verifies certain properties. /// </summary> /// <param name="e">An EventArgs object that contains the event data.</param> protected override void OnLoad(EventArgs e) { if ((Page != null) && !Page.IsPostBack) { if ((TargetID != String.Empty) && (Target == null)) { // TargetID cannot be found throw new Exception(GetStringResource("TabStripInvalidTargetID")); } foreach (TabItem item in Items) { if (item is Tab) { Tab tab = (Tab)item; PageView target = tab.Target; if ((tab.TargetID != String.Empty) && (target == null)) { // TargetID cannot be found throw new Exception(GetStringResource("TabInvalidTargetID")); } } } SetTargetSelectedIndex(); } base.OnLoad(e); }
/// <summary> /// Activates the targetted PageView within a MultiPage control. /// </summary> private void SetTargetSelectedIndex() { int arrayIndex = Items.ToArrayIndex(SelectedIndex); if (arrayIndex >= 0) { Tab tab = (Tab)Items[arrayIndex]; MultiPage multiPage = Target; if (multiPage != null) { PageView page = (tab == null) ? null : tab.Target; if ((page != null) && !page.Selected) { if (_OldMultiPageIndex < 0) { _OldMultiPageIndex = multiPage.SelectedIndex; } // Activate the PageView page.Activate(); } } } }
/// <summary> /// The rendering path for downlevel browsers. /// </summary> /// <param name="writer">The output stream that renders HTML content to the client.</param> protected override void RenderDownLevelPath(HtmlTextWriter writer) { if (Width == Unit.Empty) { Width = Unit.Percentage(100); } AddAttributesToRender(writer); string padding = Util.ExtractNumberString(Style["padding"]); if (padding != String.Empty) { writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, padding); } writer.RenderBeginTag(HtmlTextWriterTag.Table); writer.RenderBeginTag(HtmlTextWriterTag.Tr); // Only render the page that is visible PageView page = SelectedPage; if (page != null) { page.RenderControl(writer); } // base.RenderDownLevelPath(writer); writer.RenderEndTag(); writer.RenderEndTag(); }
/// <summary> /// The rendering path for visual designers. /// </summary> /// <param name="writer">The output stream that renders HTML content to the client.</param> protected override void RenderDesignerPath(HtmlTextWriter writer) { if (Width == Unit.Empty) { Width = Unit.Percentage(100); } AddAttributesToRender(writer); writer.RenderBeginTag(HtmlTextWriterTag.Div); // Only render the page that is visible PageView page = SelectedPage; if (page != null) { page.RenderControl(writer); } writer.RenderEndTag(); }