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

Tab onclick

2 Answers 397 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Drew
Top achievements
Rank 1
Drew asked on 19 May 2009, 09:44 PM
is it possible to add a client-side onclick event to just one tab? i see there is the tabstrip event "onclienttabselected" but that fires when every tab is clicked. i only want to execute a function for one tab. if this is the case, the only option i can see is firing the event on every tab click and then checking if it is the tab i want (is there a way to look up tabs client-side by index?), then processing accordingly. any guidance here would be helpful.

thanks,
drew

2 Answers, 1 is accepted

Sort by
0
Accepted
Paul
Telerik team
answered on 21 May 2009, 01:07 PM
Hello Drew,

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

<form id="form1" runat="server">  
<asp:ScriptManager ID="ScriptManager1" runat="server">  
</asp:ScriptManager> 
 
<script type="text/javascript">  
function OnClientTabSelected(sender, eventArgs) {  
    var tab = eventArgs.get_tab();  
    if (tab.get_index() == "2") {  
    alert("1");  
    }  
}    
</script> 
 
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" OnClientTabSelected="OnClientTabSelected">  
<Tabs> 
    <telerik:RadTab runat="server" Text="Root RadTab1">  
    </telerik:RadTab> 
    <telerik:RadTab runat="server" Text="Root RadTab2">  
    </telerik:RadTab> 
    <telerik:RadTab runat="server" Text="Root RadTab3">  
    </telerik:RadTab> 
    <telerik:RadTab runat="server" Text="Root RadTab4">  
    </telerik:RadTab> 
    <telerik:RadTab runat="server" Text="Root RadTab5">  
    </telerik:RadTab> 
</Tabs> 
</telerik:RadTabStrip> 
</form> 


Regards,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Drew
Top achievements
Rank 1
answered on 21 May 2009, 05:38 PM
this will work, thank you. i feel it would be better to associate client-side events per-tab or at least to have this option available. is there any reason why you decided against this?
Tags
TabStrip
Asked by
Drew
Top achievements
Rank 1
Answers by
Paul
Telerik team
Drew
Top achievements
Rank 1
Share this question
or