Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How to hide/show tabpanels in TabContainer?

Avatar of gpfcall8
gpfcall8 asked on
.NET ProgrammingASP.NETVisual Basic.NET
8 Comments1 Solution1286 ViewsLast Modified:
I have some javascript that hides/shows tabPanels inside a tabContainer, based on a value from
a dropdown control.  It's triggered from the onchange event of the dropdown and it works fine (hides/shows the correct panels).  But when I try to call the Javascript on the form's onInit() routine (c# codebehind), the $get(tbDetails1ID).control returns undefined.  $get(tbDetails1ID) does return something (the id is valid) but the control is not defined at that point in the form's loading process (I guess).  I've tried moving the Javascript call from the form's OnInit() to the TabContainer's prerender event with no luck.

Also, I tried to use this.tbDetails1.Enabled = true/false when the page loads (instead of calling the Javascript) but then when I then choose from the dropdown list, it then calls the Javascript and unhides the tabpanel, but all the controls in the panel are greyed out.  I tried to set tbDetails._enabled=true in the Javascript and tbDetails.set_enabled(true) in the Javascript but all the controls in the tab are still disabled.

Is there a way to call the Javascript from some event where these get.controls are defined, or
do I need to loop through all the controls in the tabpanel and reenable each of them in the Javascript?  Or is there other way entirely of showing/hiding tabpanels inside a TabContainer which can be set in both Server and Client-side code?

Thanks for any info.


//Hides/Shows different tabs based on the dropdown value
function OnDropDownChange(drpDownID, tbDetails1ID, tbDetails2ID, tbContainerID)
{
    debugger;
   // $get(tbID).style.display = 'none';
 
    var drpDownType = $get(drpDownID);
    var tabDetails1 = $get(tbDetails1ID).control;
    var tabDetails2 = $get(tbDetails2ID).control;
    var tabContainer = $get(TbContainerID).control;
 
    if (drpDownType.value.toString().match("Detail1"))
    {
        tabDetails1._show();
        tabContainer.set_activeTabIndex(tabDetails1._tabIndex);
        tabDetails2._hide();
   }
   else
    {
        tabDetails2._show();
        tabContainer.set_activeTabIndex(tabDetails1._tabIndex);
        tabDetails1._hide();
   }
ASKER CERTIFIED SOLUTION
Avatar of gpfcall8
gpfcall8

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answers