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

Selection of already selected tab

3 Answers 66 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Tahami
Top achievements
Rank 1
Tahami asked on 16 Dec 2008, 07:54 AM
Hello there,

I have a scenario in which i need to do some processing on client side whenever a tab is selected. I am using OnClientTabSelected event for this. The problem is that the JS function associated with this event is never called when I click an already selected tab. I need to redo my processing in this case. It seems that tabstrip control doesn't raise the event when you click an already selected tab. Please help.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Dec 2008, 11:01 AM
Hi,

One suggestion will be to add OnClick  client event to the TabStrip and try the required code in that. So that it will fire even if the tab is selected.

ASPX:
<telerik:RadTabStrip ID="RadTabStrip1" runat="server"  OnClick="OnClick()"    > 
          <Tabs> 
            <telerik:RadTab Text="Item1"  ></telerik:RadTab> 
             <telerik:RadTab Text="Item2"  ></telerik:RadTab> 
              <telerik:RadTab Text="Item3"  ></telerik:RadTab> 
          </Tabs> 
        </telerik:RadTabStrip> 

JS:
<script type="text/javascript"
function OnClick() 
 //try your code here 
</script> 


Thanks
Princy
0
Accepted
Paul
Telerik team
answered on 18 Dec 2008, 03:22 PM
Hi Tahami,

You can easily achieve your goal by using the ClickSelectedTab property of the tabstrip.

<form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
 
    <script type="text/javascript">  
    function test()  
    {  
        alert();  
    }  
    </script> 
 
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" OnClientTabSelected="test" ClickSelectedTab="true">  
        <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> 
        </Tabs> 
    </telerik:RadTabStrip> 
</form> 


Sincerely yours,
Paul
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tahami
Top achievements
Rank 1
answered on 19 Dec 2008, 04:56 AM
Thanks, I have tried Paul's solution and its working perfect. Thanks everyone.
Tags
TabStrip
Asked by
Tahami
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Paul
Telerik team
Tahami
Top achievements
Rank 1
Share this question
or