views:

483

answers:

1

Hello,

I am using Ajax tab container control with 3 tabs. I have placed a user control in each of the tabs.

All the 3 controls on getting loaded on page load. How do I refresh the Tabcontainer on click of each tab.

The reason I need this is, In the userControl that is in the 1st tab, I am hiding some controls based on a buttonclick. If I click on the 2nd tab and 3rd tab if I click on the first tab, the hidden controls are not visible. I want to reload the tabcontainer when a user clicks on the tabs.

Please help.

A: 

You have the DynamicContextKey on tabPanel you can use to. On the ActiveChanged Event of your TabContainer, your will put visible true or false to the user control you want conditional to the DynamicContextKey.

void yourTabContainer_ActiveTabChanged(object sender, EventArgs e)
    {
      switch (yourTabContainer.ActiveTab.DynamicContextKey)
      {
        case "Key1":
          userControl1.Visible = false;
          userControl2.Visible = true;
          break;
        case "Key2":
          userControl1.Visible = true;
          userControl2.Visible = false;
          break;
       }
    }

You will load all your control in your panel, and hide the control you want depend the DynamicContextKey selected.

Is it answer to your question ?

Cédric Boivin
I have tabindex on all the 3 tabs. On tabclick it is going to correct tabs and displaying data. But I want to refresh the container on tabclick
acadia