TabContainer tabs enabled/disabled

Last post 10-08-2008 4:01 AM by Thomas Sun – MSFT. 5 replies.

Sort Posts:

  • TabContainer tabs enabled/disabled

    09-30-2008, 5:04 PM
    • Member
      97 point Member
    • WilliamSnell
    • Member since 09-24-2008, 5:47 PM
    • Glendale, AZ
    • Posts 224

    I'm using a TabContainer control, which is in a User Control, which is in a Content Page. What I want is to have all but one of the tabs disabled on page load, but after the user completes filling in the form and clicks submit, the other tabs get enabled. So far, I have set the Enabled="false" on each of the TabPanels except the first one, and here is where the first problem arises. Not only are they disabled - they're invisible! When a control is disabled, the user is accustomed to seeing it greyed out and not useable, but still there. Is there a way to disable the tabs without removing them entirely? I tried setting the Visibility to true, but this didn't help.

    After that, I need to re-enable them. I'm able to get a reference to the Tabs collection of the TabContainer in my code-behind, using a lengthy FindControls chain, and am able to set its Enabled property to true. However, nothing happens. The code executes without error, but the tab doesn't reappear. I see on the AjaxControlToolkit site that, through some JavaScript, the enabled state can be toggled. The problem is that, with my executing code nested within a User Control, I'm not able to get the JavaScript to fire. The button that fires the event is in the User Control, and the JavaScript would be (I assume) in the header ContentPlaceholder of the Content Page in which the User Control is registered. How can I get this to work?

    It's not how hard you push in life, but who you push, that makes the difference between success and running for your life.
  • Re: TabContainer tabs enabled/disabled

    10-03-2008, 4:54 AM
    Answer

    Hi,

    If we set TabPanel's Enable property to false, this tab will not be display. This is by design.  

    We can put the JavaScript in the Master page or Content page because these pages will be migrated into one page.

    The Tab control's client id will be changed to the following format "ctl00_ContentPlaceHolder1_WebUserControl1_Tabs" (We can get it by viewing page Source in client). So we need to make sure that we use the correct id in the JavaScript.

     

    I look forward to hearing from you.

     

    Thomas Sun
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
  • Re: TabContainer tabs enabled/disabled

    10-06-2008, 5:14 PM
    • Member
      97 point Member
    • WilliamSnell
    • Member since 09-24-2008, 5:47 PM
    • Glendale, AZ
    • Posts 224

    Thanks for responding! I have successfully enabled the tabs through javascript wired to a button click event. The problem that I'm having now is that, when the tabs are set to Enabled="true", all of the controls that are within the tab are still disabled. Since it seems that the TabPanel is disabling all controls within it when it is set to Enabled="false", is there a reason that the TabPanel doesn't enable the controls within it when it is set to Enable="true"?

    It's not how hard you push in life, but who you push, that makes the difference between success and running for your life.
  • Re: TabContainer tabs enabled/disabled

    10-06-2008, 10:16 PM

    Hi,

    The Enabled property of TabPanel is used to decide whether to display the Tab for the TabPanel.  

    In this case, to disable or enable control that exists in Tab, we need to refer to this control and set its Enabled property.

     

    Thanks. 

    Thomas Sun
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
  • Re: TabContainer tabs enabled/disabled

    10-07-2008, 2:33 PM
    • Member
      97 point Member
    • WilliamSnell
    • Member since 09-24-2008, 5:47 PM
    • Glendale, AZ
    • Posts 224

    I was hoping to understand why the controls contained within a TabPanel are disabled in the first place. I did not explicitly disable any controls except the TabPanel. Then, after an event fires, I set the Enabled="true" for the TabPanel, and it appears.

    However, all of the controls within it are still disabled. It is obvious to me that the TabPanel itself disables all of its child controls when it is disabled. Since the TabPanel is not displayed, and cannot be used, I don't understand why it would be necessary to disable its child controls. Barring that, I cannot understand why, if the TabPanel disabled all child controls within it when disabled, why does it not enable them when it is enabled?

    If I have to go through and obtain client id's for all of the child controls and explicitly enable them, the TabContainer becomes nearly useless to me, as this is a maintenance nightmare. Each time I make changes to the controls within it, I'll have to modify my enable script to compensate. Again, I never disabled any of the controls within the TabPanel, only the TabPanel itself.

    It's not how hard you push in life, but who you push, that makes the difference between success and running for your life.
  • Re: TabContainer tabs enabled/disabled

    10-08-2008, 4:01 AM
    Answer

    Hi,

    I see your another post (http://forums.asp.net/t/1329155.aspx) related to this issue. We can continue our discussion in that post.

     

    Thanks.

    Thomas Sun
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
Page 1 of 1 (6 items)