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

OnClientTabSelecting sender.get_selectedTab().get_text() is incorrect

1 Answer 91 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Gary B.
Top achievements
Rank 1
Gary B. asked on 23 Sep 2009, 08:10 PM
My problem happens after I have added and removed a tab.
var tabStrip = $find("<%= RadTabStrip1.ClientID %>"); 
var selectedTab = tabStrip.findTabByText("StopOffs"); 
tabStrip.trackChanges(); 
if (selectedTab == null) { 
    var tab = new Telerik.Web.UI.RadTab(); 
    tabStrip.get_tabs().insert(2,tab); 
    tab.set_text("StopOffs"); 
    tab.set_pageViewID("TABSTOPOFF"); 
    selectedTab = tabStrip.findTabByText("StopOffs"); 
... 
if (a == "YES") { 
    selectedTab.set_visible(true); 
else { 
    tabStrip.get_tabs().remove(selectedTab); 
tabStrip.commitChanges(); 
So assume this code has been executed and a == "NO".
(If a == "YES" then the tab is added and everything happens as expected.)
The problem is after I leave the tab I need an event to fire based on the tab I leave, but OnClientTabSelecting is giving me the wrong tab name.
function OnClientTabSelecting(sender, eventArgs) { 
    var selectedTab = sender.get_selectedTab().get_text(); 
    alert (selectedTab); 
So, in the case described above when I leave tab "Questions" OnClientTabSelecting will alert "References".
But, if the a == "YES", and therefore "StopOffs" is in the tabStrip and shown, then when I leave tab "Questions" OnClientTabSelecting will alert "Questions" like it is supposed to.
Also, if I never reach the function shown in the first code block (that is "StopOffs" tab was never added) then when I leave tab "Questions" OnClientTabSelecting will also alert "Questions" like it is supposed to.
Note: StopOffs tab is to the left of Questions tab. I don't know why it matters, but I add tabs to the right of Questions without an issue.
Thanks for any help.

1 Answer, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 24 Sep 2009, 01:32 PM
Hi Gary,

I think it will be best if you can open a support ticket and send us a simple running project (incl. your custom skin, CSS, images, DB backup if needed and so on) demonstrating the problem (and step-by-step instructions on doing so). In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

Regards,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
TabStrip
Asked by
Gary B.
Top achievements
Rank 1
Answers by
Paul
Telerik team
Share this question
or