Solved

Linking to data within a sibling AJAX tab

Posted on 2007-11-29
2
322 Views
Last Modified: 2013-11-26
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.
0
Comment
Question by:CaptCredence
2 Comments
 
LVL 7

Accepted Solution

by:
Infinite_Recursion earned 250 total points
ID: 20377495
function setActiveTab(tabNumber)
   {
        var ctrl = $find('<%=TabContainer.ClientID%>');
        ctrl.set_activeTab(ctrl.get_tabs()[tabNumber]);                  
   }

this is a function that sets the active tab using javascript so you just set the anchor's href to look like this:
<a href='setActiveTab(1)'>Go to Next Tab</a>;
referenced from:
http://forums.asp.net/p/1098533/1666430.aspx
0
 

Author Comment

by:CaptCredence
ID: 20407283
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
        }
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now