Link to home
Start Free TrialLog in
Avatar of CaptCredence
CaptCredence

asked on

Linking to data within a sibling AJAX tab

I have setup a page using tabs from the ASP.NET Ajax Toolkit. One requirement is for a hyperlink on one tab on the page to redirect the user to data appearing on another non-defaulted tab of that page. Is there a way to do this? Here's the code:

 <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">

            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1">
                <ContentTemplate>
                    <a href="???">Click here to view your data</a>
                </ContentTemplate>
            </cc1:TabPanel>

            <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2">
                <ContentTemplate>
                    Target Data user is looking for ...
                </ContentTemplate>
            </cc1:TabPanel>

        </cc1:TabContainer>

I want to place a link on tab panel 1 that points to data within tab panel 2. What I need to know is what to put in place of "???".

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Infinite_Recursion
Infinite_Recursion

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CaptCredence
CaptCredence

ASKER

The javascript didn't work for me, but after digesting the article, here's what I ended up using:

On the client:
 <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">

            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1">
                <ContentTemplate>
                     <asp:LinkButton ID="lbtnSecondaryData" runat="server"
                          Text='Click here for secondary data' OnClick="lbtnSecondaryData_Click" />
               </ContentTemplate>
            </cc1:TabPanel>

            <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2">
                <ContentTemplate>
                    Secondary Data user is looking for ...
                </ContentTemplate>
            </cc1:TabPanel>

        </cc1:TabContainer>


On the server:
        protected void lbtnSecondaryData_Click(object sender, EventArgs e)
        {
            TabContainer1.ActiveTabIndex = 1;       // Make the Secondary tab active and appear
        }