Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a AJAX TabContainer which in turn contains UserControls in each TabPanel. When the tab is changed i want to call the Page_Load event of the UserControl, as shown below:

XML
<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" AutoPostBack="true">
                            <ajaxToolkit:TabPanel ID="pnlEmployeeInfo" runat="server">
                                <HeaderTemplate>
                                    Basic Info.
                                </HeaderTemplate>
                                <ContentTemplate>
                                    <uc1:EmpInfo ID="EmpInfo1" runat="server" />
                                </ContentTemplate>
                            </ajaxToolkit:TabPanel>
                            <ajaxToolkit:TabPanel ID="pnlSalary" runat="server">
                                <HeaderTemplate>
                                    Salary</HeaderTemplate>
                                <ContentTemplate>
                                    <uc2:Salary ID="Salary1" runat="server" />
                                </ContentTemplate>
                            </ajaxToolkit:TabPanel>
                            <ajaxToolkit:TabPanel ID="pnlAppraisal" runat="server">
                                <HeaderTemplate>
                                    Appraisals</HeaderTemplate>
                                <ContentTemplate>
                                    <uc3:Appraisal ID="Appraisal1" runat="server" />
                                </ContentTemplate>
                            </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer>


Can anybody suggest how this can be done...
Posted

1 solution

Write OnActiveTabChanged event for the TabContainer you have.
And this setup is definitely in a Page where you are loading all the UserControls inside the Tab Container.. so all individual usercontrols's Page_Load events fires when this Page loads.

Now keep all the Page_Load functionality into a Public Method and when a Tab is changed call that method using UserControlID.PublicMethod.


Hope this helps...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900