Advertisement

06.04.2008 at 11:19AM PDT, ID: 23457756
[x]
Attachment Details

Need to change TabContainer's TabPanel in a User Control

Asked by sjd01032 in .NET Framework 2.0, Asynchronous Javascript and XML (AJAX)

Tags: ASP.NET 2.0 & AJAX, IE 6

I've created a User Control (see code below) called TabNavigate.ascx.  I consume this UC in multiple pages (3 for this example).  In the code behind of the code for the UC, I catch the Tabs_ActiveTabChanged event and based on the HeaderText call a Response.Redirect to the correct page.

This all works just fine.  The problem is that the selected tab never changes to the correct tab.  I've tried putting the following code just before each Response.Redirect with no luck:  tabContainer.ActiveTabIndex = 1;
Replace the number one with the zero based index that I want to be selected.

What do I do either in the User Control or the consuming page that will select the correct tab?

I'll be offline for the next 3 hours, but will pick up after that.  Thank you!Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
<%@ Control Language="C#" AutoEventWireup="false" CodeFile="TabNavigate.ascx.cs" Inherits="UserControls_Navigation_TabNavigate" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
 
    <script type="text/javascript">
        function PanelClick(sender, e) {
            var Messages = $get('<%=Messages.ClientID%>'); 
            Highlight(Messages);
        }
 
        function ActiveTabChanged(sender, e) {
            var CurrentTab = $get('<%=CurrentTab.ClientID%>');
            CurrentTab.innerHTML = sender.get_activeTab().get_headerText();
            Highlight(CurrentTab);
        }
 
        var HighlightAnimations = {};
        function Highlight(el) {
            
        }
        
        function ToggleHidden(value) {
            $find('<%=Tabs.ClientID%>').get_tabs()[2].set_enabled(value);
        }
    </script> 
    
    <ajaxToolkit:TabContainer runat="server" ID="Tabs" Height="0px" ActiveTabIndex="0" Width="965px" 
        OnActiveTabChanged="Tabs_ActiveTabChanged" AutoPostBack="true" OnClientActiveTabChanged="ActiveTabChanged">
        <ajaxToolkit:TabPanel runat="server" ID="tpnlRegistration" HeaderText="Registration" />
        
        <ajaxToolkit:TabPanel runat="server" ID="tpnlAssessment" HeaderText="Assessment" />
        
        <ajaxToolkit:TabPanel runat="server" ID="tpnlDemographics" HeaderText="Demographics" />
        
     </ajaxToolkit:TabContainer>           
 
Current Tab:
        <asp:Label runat="server" ID="CurrentTab" /><br />
        <asp:Label runat="server" ID="Messages" />
[+][-]06.04.2008 at 03:03PM PDT, ID: 21714568

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET Framework 2.0, Asynchronous Javascript and XML (AJAX)
Tags: ASP.NET 2.0 & AJAX, IE 6
Sign Up Now!
Solution Provided By: MakarandSKolhe
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628