Showing posts with label strange. Show all posts
Showing posts with label strange. Show all posts

Monday, March 26, 2012

Tab Control Disappears when passing parameter to JavaScript function

Hello everybody!

I have a quite strange error on my hands here. And just to explain, this is what I want to do:

I created a tab control (AJAX) by:

"privatevoid constructTabs()

{

AjaxControlToolkit.TabContainer myTabs=new AjaxControlToolkit.TabContainer();

myTabs.Tabs.Add(loadPanel("NameOfTabGoesHere")); //this is donen times

myTabs.ActiveTab = productTabs.Tabs[0]; //to set the first tab as the active tab

myTabs.OnClientActiveTabChanged = "inVisiblePlans('" +myTabs.ActiveTab.ID.ToString() + "')"; //inVisiblePlans is my javascript function

Panel newPanel =newPanel();

newPanel.Controls.Add(productTabs);

this.Controls.Add(newPanel);

}

"

the function works ok but the problem is, the tab controls cannot be seen? it(the panel) is actually rendered with "hidden" attribute. And the strange thing is, if I domyTabs.OnClientActiveTabChanged = "inVisiblePlans";

The panels are visible but the page is of course useless.

All help will be greatly appreciated! Thanks is advance

Eduardo

Hello again.. about 15 minutes after I posted my question.. I got the answer myself... *slaps himself on the foreheadStick out tongue

instead of usingOnClientActiveTabChanged , I used this:

tabPanel.OnClientClick ="function(){inVisiblePlans('" + tabPanel.ID.ToString() +"');}";

everytime I add a tabPanel.

meaning:

I did not attach the javascript to the whole tabcontrol but attached a call to it in every panel and it works fine now. Am still wondering tho, why the first idea did not work.

Am posting this for all who experience the same problem.

Many thanks!

TAB control is hidden on IE7

I've found a strange problem that occured only on IE7

I have a wep page (MAINPAGE) that containt an IFRAME. This page is use to put our menu. The content of our website is display inside the iframe. So here is the problem. I have made some page with the new tab control. I will call those page PAGE1 and PAGE2. So if i put a hyperlink in PAGE1 to open PAGE2 everything is working fine. In our menu i use this:

"window.frames('fraMain').location.href = '" & row("URL").ToString & "';"

This is is code for the event onclick in our menu. So when i use this code to open either PAGE1 or PAGE2 the tab control is not displayed. I've got a javascript error "unspecified error" and if i look at the source code this is what the tab control looks like:

<div id="ctl00_Contenu_TABGENERAL" class="ajax__tab_Orchestra"style="visibility:hidden;">

So there is avisibility:hidden add to the code. This only occured on IE7 and when my pages are called using this line of code "window.frames('fraMain').location.href = '" & row("URL").ToString & "';".

We've been using this line of code for years and never have any problem with any other pages that don't containt the TAB control.

Any idea ?

I've made some other test and i notice that the problem only occured the first time i open the page with our menu. So if i click on our menu to open the page the Tab control is not displayed. Then if i click again the tab control work just fine. I don't have this problem with Firefox.