My problem happens after I have added and removed a tab.
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.
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.
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(); |
(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); |
} |
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.