Select ChildTab in Code Behind

5 posts, 0 answers
  1. Reini
    Reini avatar
    6 posts
    Member since:
    Sep 2004

    Posted 31 Jul 2009 Link to this post

    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

     

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 03 Aug 2009 Link to this post

    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.
  3. Reini
    Reini avatar
    6 posts
    Member since:
    Sep 2004

    Posted 04 Aug 2009 Link to this post

    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);

     

     

    }

  4. Guy
    Guy avatar
    1 posts
    Member since:
    Dec 2007

    Posted 02 Sep 2009 Link to this post

    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
  5. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 02 Sep 2009 Link to this post

    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.
Back to Top