/// <summary> /// Called if ActiveViewIndex is changed /// </summary> private void RebuildTabs() { _tabContainer.Controls.Clear(); ViewCollection views = _multiView.Views; for (int i = 0; i < views.Count; i++) { TabularView view = (TabularView)views[i]; _tabContainer.CreateTab(this, view, i); } }
/// <summary> /// Creates a new tab for the specified <c>view</c> within the given <c>container</c>. /// </summary> /// <param name="container">The <see cref="TabularMultiView"/> containing the <c>view</c></param> /// <param name="view">The <see cref="TabularView"/> for which a new tab is to be created.</param> /// <param name="index">The index of the tab to be created.</param> /// <remarks> /// By default, <see cref="LinkButton"/> controls are used for rendering tabs. Override this method to /// change this behaviour. /// </remarks> protected internal virtual void CreateTab(TabularMultiView container, TabularView view, int index) { LinkButton btnTab = new LinkButton(); btnTab.Text = view.TabName; btnTab.CommandName = "SelectTab"; btnTab.CommandArgument = "" + index; btnTab.ID = "Tab" + index; btnTab.ToolTip = view.TabToolTip; btnTab.Enabled = !view.Active; WebControl span = new WebControl(HtmlTextWriterTag.Span); span.CssClass = (view.Active) ? container.TabularMenuSelectedItemCSS : container.TabularMenuItemCSS; span.Controls.Add(btnTab); this.Controls.Add(span); }