Tab onclick

3 posts, 1 answers
  1. Drew
    Drew avatar
    22 posts
    Member since:
    Mar 2009

    Posted 19 May 2009 Link to this post

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

    Posted 21 May 2009 Link to this post

    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.
  3. Drew
    Drew avatar
    22 posts
    Member since:
    Mar 2009

    Posted 21 May 2009 Link to this post

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