Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
600
Can't seem to disable a tab when EnableAjax="true"
posted

We want to enable/disable all the tabs except the one the user is working on, based on conditions at runtime.

To simply illustrate the problem we're having, I created a webtab with a button on Tab[0]. In the Click event handler for the button, I coded

WebTab1.Tabs[1].Enabled = false;

When WebTab1.PostBackOptions.EnableAjax is set to false, this works; when set to true, it does not. I tried setting all the various other PostBackOptions, and I tried this:

 WebTab1.Tabs[1].GetUpdatePanel(true).Update();

to manually force a refresh. I also look for other properties or methods of the webtab and the contenttabitem classes, but nothing looked promising.

It seems I can disable controls inside the ConentPanes of the tabs just fine, but I cannot affect the webtab itself or the tabs collection.

Can anyone help? Thanks.

-BillyB

 

 

Parents
No Data
Reply
  • 19693
    Verified Answer
    posted

    Hello Billy,

    This happens because when the property EnableAjax is true, then not all the data regarding the grid is transfered  to the server and back.

    You may disable the second tab but this information is not transitioned to the client and therefore the WebTab is not refreshed (you can check the data transitioned by the server in the response if you use Firebug or similar tool).

    I recomend you to disable the tab on client side ,if you want to get advantage of the AJAX funcionality. For example :

    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="setDisabled();" />

                   

    function setDisabled() {

                var tab = $find("<%=WebTab1.ClientID %>");

                tab.get_tabs()[1].set_enabled(false);

            }

    Let me know if you need further assistance regarding this.

Children