This is a migrated thread and some comments may be shown as answers.

Select ChildTab in Code Behind

4 Answers 189 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Konstantin Spielmann
Top achievements
Rank 1
Konstantin Spielmann asked on 31 Jul 2009, 04:06 PM
Hello,

I have a Tabstrip.
The following is a snippet showing relevant ASPX code.
I can select the Tabs in the code behind with rtsTab.SelectedIndex = 2.
But how can I select the Child-Tabs in the code behind?

<telerik:RadTabStrip ID="rtsTab" runat="server" OnClientTabSelecting="onTabSelecting"

 

 

SelectedIndex="0" Skin="Vista" Width="100%" MultiPageID="mpTab">

 

 

<Tabs>

 

 

<telerik:RadTab runat="server" PageViewID="pv1" Selected="True" Text="Tab1">

 

 

</telerik:RadTab>

 

 

<telerik:RadTab runat="server" PageViewID="pv2" Text="Tab2">

 

 

</telerik:RadTab>

 

<telerik:RadTab runat="server" Text="Tab3" SelectedIndex="0">

 

 

<Tabs>

 

 

<telerik:RadTab Text="Child1" PageViewID="pvC1" Selected="True" />

 

 

<telerik:RadTab Text="Child2" PageViewID="pvC2" />

 

 

</Tabs>

 

 

</telerik:RadTab>

 

</Tabs>

Thanks
Thomas

 

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Aug 2009, 09:18 AM
Hello Thomas,

You can set the child tab selected using the following code:
c#:
 rtsTab.Tabs[2].SelectedIndex = 1; 
 
// (or) 
 
 rtsTab.FindTabByText("Tab3").SelectedIndex = 1; 

Thanks
Princy.
0
Konstantin Spielmann
Top achievements
Rank 1
answered on 04 Aug 2009, 02:14 PM
Hello Princy, thanks for your answer.

This works fine when i use it at the page load event but I have stille a problem when I use it with a radgrid and the itemcommand object.

See the code below. Where is my mistake? The pageview change correctly to the new index but not the Tab to the Child Tab.

 

protected void Grid1_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

GridDataItem dataItem = e.Item as GridDataItem;

 

 

string AbrechnungsID= dataItem["Test_ID"].Text;

 

 

 

 

rtsTab.Tabs[5].SelectedIndex = 1;

 

RadPageView.SelectedIndex = 5;

 

 

 

 

DatabindExpabrechnungDetail(AbrechnungsID);

 

 

}

0
Guy
Top achievements
Rank 1
answered on 02 Sep 2009, 10:41 AM
Any answer to this?
I have a button that changes the pageview OK, but won't select the tab in the button click event in code-behind. It works in the OnLoad event, like the original poster.

Protected Sub ImageButtonFlip_Click(ByVal sender As ObjectByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButtonFlip.Click 
        Me.MultiView1.SetActiveView(Me.ViewInformation)         ' This works 
        Me.RadTabStrip1.FindTabByValue("Info").Selected = True  ' This doesn't 
End Sub 

Thanks.
Guy
0
Paul
Telerik team
answered on 02 Sep 2009, 11:08 AM
Hello Guy,

Here's your modified code snippet that shows the needed approach.

Protected Sub Button1_Click(sender As Object, e As EventArgs) 
    Dim tab As RadTab = RadTabStrip1.FindTabByValue("Info"
    tab.Selected = True 
    tab.SelectParents() 
End Sub 


Sincerely yours,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TabStrip
Asked by
Konstantin Spielmann
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Konstantin Spielmann
Top achievements
Rank 1
Guy
Top achievements
Rank 1
Paul
Telerik team
Share this question
or