Article information
Article relates to
RadTabStrip v2.x
Created by
Paul, Telerik
Last modified
June 19, 2006
Last modified by
HOW-TO Provide Windows-like behavior for RadTabStrip SOLUTION You need to hook the TabClick server event of the control and provide an appropriate program logic to switch the rows of the tabstrip when needed. Please review the code snippets provided below for further details on the implementation approach (note that the example will work for two-row tabstrip): //in the aspx of the page <radts:RadTabStrip id="RadTabStrip1" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 16px" runat="server" Theme="BlueBar" AutoPostBack="True" TabDisplayMode="MultiRow"> <TabCollection> <radts:Tab TextOnlyTabs="False" Text="Tab1"> <radts:Tab Text="subTab1"></radts:Tab> </radts:Tab> <radts:Tab TextOnlyTabs="False" Text="Tab2"> <radts:Tab Text="subTab2"></radts:Tab> </radts:Tab> <radts:Tab TextOnlyTabs="False" Text="Tab3"> <radts:Tab Text="subTab3"></radts:Tab> </radts:Tab> <radts:Tab IsBreak="True" TextOnlyTabs="False" Text="Tab4"> <radts:Tab Text="subTab4"></radts:Tab> </radts:Tab> <radts:Tab TextOnlyTabs="False" Text="Tab5"> <radts:Tab Text="subTab5"></radts:Tab> </radts:Tab> <radts:Tab TextOnlyTabs="False" Text="Tab6"> <radts:Tab Text="subTab6"></radts:Tab> </radts:Tab> <radts:Tab TextOnlyTabs="False" Text="Tab7"> <radts:Tab Text="subTab7"></radts:Tab> </radts:Tab> <radts:Tab TextOnlyTabs="False" Text="Tab8"> <radts:Tab Text="subTab8"></radts:Tab> </radts:Tab> </TabCollection> </radts:RadTabStrip>
//and in the code behind protected Telerik.WebControls.RadTabStrip RadTabStrip1; private void InitializeComponent() { this.RadTabStrip1.TabClick += new Telerik.WebControls.RadTabStrip.RadTabStripTabClickEventHandler (this.RadTabStrip1_TabClick); this.Load += new System.EventHandler(this.Page_Load); } private void RadTabStrip1_TabClick(object sender, Telerik.WebControls.RadTabStripClickEventArgs args) { if(args.ClickedTab.Parent.ID != "RadTabStrip1") { return; } ArrayList col = new ArrayList();
foreach(Tab tab in RadTabStrip1.TabCollection) { if(tab.IsBreak == true) {
if(args.ClickedTab.Index <= tab.Index) { for(int i = 0; i <= tab.Index; i++) { col.Add(RadTabStrip1.TabCollection[i]); } int index = tab.Index;
for(int j = 0; j <= index; j++) { RadTabStrip1.TabCollection.RemoveAt(0); } break; } else { break; } } }
RadTabStrip1.TabCollection[RadTabStrip1.TabCollection.Count-1].IsBreak = true;
for(int j = 0; j < col.Count; j++) { RadTabStrip1.TabCollection.Add((Tab)col[j]); }
RadTabStrip1.SelectedIndex = args.ClickedTab.Index; }
Resources Buy Try