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

SelectedTab undefined client side

2 Answers 96 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
khurram
Top achievements
Rank 1
khurram asked on 15 Jul 2008, 08:43 PM
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 Answers, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 16 Jul 2008, 03:45 PM
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
0
khurram
Top achievements
Rank 1
answered on 16 Jul 2008, 06:31 PM
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
Tags
TabStrip
Asked by
khurram
Top achievements
Rank 1
Answers by
Paul
Telerik team
khurram
Top achievements
Rank 1
Share this question
or