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
115
When does a control get initialized on subsequent tab pages?
posted

Hi,

How can we access a control that is on 2nd, 3rd, etc. tab?  I am trying to access a control on Page_load that is on the 2nd tab.  When I check the control, it is null...it doesn't appear that it was initialized.  Please help...

Thanks,

Steve

  • 12679
    posted

    Hi Steve,

    Let me know if you need further assistance with this.

    Thanks

  • 12679
    Suggested Answer
    posted

    Hello Steve,

    If you are using UltaWebTab you should be able to access the control in page_load event as you use FindControl method.

    So, let suppose that you have the following tab declaration in the aspx page

     <igtab:UltraWebTab ID="UltraWebTab1" runat="server">
                <Tabs>
                    <igtab:Tab Key="Tab1" Text="TAb1">
                    <ContentTemplate>
                        <asp:CheckBox ID="CheckBox1" runat="server" />
                    </ContentTemplate>
                    </igtab:Tab>
                    <igtab:Tab Key="Tab2" Text="Tab2>
                      <ContentTemplate>
                          <asp:Panel ID="Panel1" runat="server">
                          </asp:Panel>
                    </ContentTemplate>
                    </igtab:Tab>
                    <igtab:Tab Key="Tab3" Text="Tab3">
                    <ContentTemplate>
                        <asp:LinkButton ID="LinkButton1" 

                     runat="server">LinkButton</asp:LinkButton>
                    </ContentTemplate>
                    </igtab:Tab>
                </Tabs>
            </igtab:UltraWebTab>

    The first tab is loaded by default when the page is rendered down to the client.  You should be able to access the content of the other tabs easily so, the code below finds the linkButton control which is placed in the third tab.

     protected void Page_Load(object sender, EventArgs e)
        {
            LinkButton tab =
                (LinkButton) ((Tab)this.UltraWebTab1
                .Tabs[2])
                .FindControl("LinkButton1");
        }

    Hope this helps