SelectedTab undefined client side

3 posts, 0 answers
  1. khurram
    khurram avatar
    13 posts
    Member since:
    May 2008

    Posted 15 Jul 2008 Link to this post

    In a particular case I need to access the selected tab and get its value on the client side. Like on a click of a certain button I want to get the selected tab and use its value to pefrom some function. 

    After going through the tabsrtip documentation i tried to use the property "SelectedTab" of tabstrip on the client side but its returning undefined. Is it the right way of doing it in javascript or am I really missing something?

    Thanks in advance.

    Regards,

    Khurram 
  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 16 Jul 2008 Link to this post

    Hello khurram,

    Please find below a sample code snippet that shows the needed approach.

    <html xmlns="http://www.w3.org/1999/xhtml">  
    <head runat="server">  
        <title>Untitled Page</title> 
        <telerik:RadCodeBlock runat="server">  
     
            <script type="text/javascript">  
            function GetValue()  
            {  
                var tabstrip = $find('<%= RadTabStrip1.ClientID %>')              
                var selectedTab = tabstrip.get_selectedTab();  
                alert(selectedTab.get_value());  
            }  
            </script> 
     
        </telerik:RadCodeBlock> 
    </head> 
    <body> 
        <form id="form1" runat="server">  
            <div> 
                <asp:ScriptManager ID="ScriptManager1" runat="server">  
                </asp:ScriptManager> 
            </div> 
            <telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="0">  
                <Tabs> 
                    <telerik:RadTab runat="server" Text="Root RadTab1" Value="tab1">  
                    </telerik:RadTab> 
                    <telerik:RadTab runat="server" Text="Root RadTab2" Value="tab2">  
                    </telerik:RadTab> 
                    <telerik:RadTab runat="server" Text="Root RadTab3" Value="tab3">  
                    </telerik:RadTab> 
                </Tabs> 
            </telerik:RadTabStrip> 
            <input id="Button1" type="button" value="button" onclick="GetValue()" /> 
        </form> 
    </body> 
    </html> 


    Best wishes,
    Paul
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. khurram
    khurram avatar
    13 posts
    Member since:
    May 2008

    Posted 16 Jul 2008 Link to this post

    Thanks Paul for your quick reply. I am going to give it a try and will let you know in case I come up with any issue.

    Regards,
    Khurram
Back to Top