[CLOSED] TabPanel.SetActiveTab with PostBack

  1. #1

    [CLOSED] TabPanel.SetActiveTab with PostBack

    Hello,

    When using the TabPanel.SetActiveTab with StateProvider PostBack it appears to be reverting back to the first tab.

    I have the following:

    <ExtJS:TabPanel ID="Tabs" runat="server" ActiveTab="0" AutoHeight="True" AutoWidth="True" AutoPostBack="True">
        <Tabs>
            <ExtJS:Tab ID="Tab1" runat="server" IconCls="TabTenderSearch" Title="Customer 1" AutoHeight="True" AutoWidth="True">
                <Content>
                    Word
                </Content>
            </ExtJS:Tab>
            <ExtJS:Tab ID="Tab2" runat="server"
    IconCls="TabTenderSearch" Title="Customer 2" AutoHeight="True"
    AutoWidth="True">
    
                <Content>
    
                    Word 2
    
                </Content>
    
            </ExtJS:Tab>
    
        </Tabs>
    </ExtJS:TabPanel>
    Code behind is:

    Tabs.SetActiveTab(Tab2);
    Cheers,
    Timothy
  2. #2

    RE: [CLOSED] TabPanel.SetActiveTab with PostBack

    Hi Timothy,

    I can't reproduce such behaviour with your posted code. Can you confirm that below example is not working for you:

    <head runat="server">
        <title>Untitled Page</title>
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                 
            }
            
            protected void TabsChanged(object sender, EventArgs e)
            {
                Tabs.SetActiveTab(Tab2); 
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ScriptManager ID="ScriptManager1" runat="server" StateProvider="PostBack" />
        <ext:TabPanel ID="Tabs" runat="server" ActiveTab="0" AutoHeight="True" AutoWidth="True"
            AutoPostBack="True" OnTabChanged="TabsChanged">
            <Tabs>
                <ext:Tab ID="Tab1" runat="server" IconCls="TabTenderSearch" Title="Customer 1" AutoHeight="True"
                    AutoWidth="True">
                    <Content>
                        Word
                    </Content>
                </ext:Tab>
                <ext:Tab ID="Tab2" runat="server" IconCls="TabTenderSearch" Title="Customer 2" AutoHeight="True"
                    AutoWidth="True">
                    <Content>
                        Word 2
                    </Content>
                </ext:Tab>
            </Tabs>
        </ext:TabPanel>
        </form>
    </body>
    The right behaivour of this example: after postback always selected second tab

    Can you post full code of your example? Where are you calling the SetActiveTab (in PageInit, PageLoad, any event handler or in PreRender). Please provide me by these information and I'll try to help you.

    Vladimir
  3. #3

    RE: [CLOSED] TabPanel.SetActiveTab with PostBack

    Hello Vladimir,

    I'll get an example ready for you tonight!

    Cheers,
    Timothy
  4. #4

    RE: [CLOSED] TabPanel.SetActiveTab with PostBack

    Got the example:

        <form runat="server">
            <script runat="server">
                protected void btnTest_Click(object s, EventArgs e)
                {
                    Tabs.SetActiveTab(TabTwo);
                }
                protected void btnTest2_Click(object s, EventArgs e)
                {
                    
                }    
            </script>
            <asp:ScriptManager runat="server" EnablePartialRendering="True" />
            <ExtJS:ScriptManager runat="server" StateProvider="PostBack" Theme="Gray" />
            <asp:UpdatePanel runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <ExtJS:TabPanel ID="Tabs" runat="server" ActiveTab="0" AutoHeight="True" AutoPostBack="True">
                        <Tabs>
                            <ExtJS:Tab ID="TabOne" runat="server" AutoHeight="True" Title="Tab 1">
                                <Content>
                                    <ExtJS:Button ID="btnTest" runat="server" &#111;nclick="btnTest_Click" Text="Test" />
                                </Content>
                            </ExtJS:Tab>
                            <ExtJS:Tab ID="TabTwo" runat="server" AutoHeight="True" Title="Tab 2">
                                <Content>
                                    <ExtJS:Button ID="btnTest2" runat="server" &#111;nclick="btnTest2_Click" Text="Test 2" />
                                </Content>
                            </ExtJS:Tab>
                        </Tabs>
                    </ExtJS:TabPanel>
                </ContentTemplate>
            </asp:UpdatePanel>
        </form>
    Click Test in the first Tab it will switch you to Tab 2. Now click Test 2 in the 2nd tab and it takes you back to Tab 1 ;)

    Cheers,
    Timothy
  5. #5

    RE: [CLOSED] TabPanel.SetActiveTab with PostBack

    Hi Timothy,

    Thank you for your code. This helped us find a bug. The fix will
    be available in svn tomorrow (Monday). Now (before the emergence of fix), I recommend to use the following code:

       // old code
       //Tabs.SetActiveTab(TabTwo);
       
       //The code, which works
       Tabs.ActiveTab = 1;
    I will inform you when the fix will be ready.

    Thanks again

    Vladimir
  6. #6

    RE: [CLOSED] TabPanel.SetActiveTab with PostBack

    Thanks! Your solution is what I've already been using, sorry I should have mentioned that in my response :)

    Will this bump to 0.5.5 or will I need to recompile with SVN?

    Cheers,
    Timothy
  7. #7

    RE: [CLOSED] TabPanel.SetActiveTab with PostBack

    Hi Timothy,

    Thanks for reporting the TabPanel bug. It has been fixed.

    At the moment the fix is only available from SVN.

    Are you building from SVN or using the public releases? We're more than happy to send you a custom build of either v0.5.4 or the current /trunk/.

    Of course, if you're building from SVN, just perform an update and everything should work as expected.

    Hope this helps.
    Geoffrey McGill
    Founder
  8. #8

    RE: [CLOSED] TabPanel.SetActiveTab with PostBack

    Thanks I used the SVN checkout this morning and it worked!

    Cheers,
    Timothy

Similar Threads

  1. SetActiveTab in GroupTabPanel
    By Rupesh in forum 1.x Help
    Replies: 4
    Last Post: Dec 11, 2010, 12:16 PM
  2. Tab - Autoload - setActiveTab After Tab loaded
    By Tbaseflug in forum 1.x Help
    Replies: 4
    Last Post: Jun 17, 2009, 4:39 PM
  3. Tabpanel problem on postback
    By ianselmi in forum 1.x Help
    Replies: 2
    Last Post: Mar 10, 2009, 7:53 PM
  4. [FIXED] [V0.6] TabPanel and SetActiveTab
    By Timothy in forum Bugs
    Replies: 2
    Last Post: Sep 10, 2008, 7:35 AM
  5. TabPanel Dynamic Tab PostBack
    By Timothy in forum Bugs
    Replies: 4
    Last Post: Aug 24, 2008, 2:52 PM

Posting Permissions