2

I updated toolkit version from 30930 (Sep 2009) to 7.1213 (Dec 2013) on a project containing a complex implementation of TabContainer. Before the update I had no issue at all with that page and TabContainer in general, but as soon as I referenced new toolkit version I found out some strange behaviors. I reduced it all in a very simple, basic standalone page, as follows:

aspx page

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TabContainerSample.aspx.cs" Inherits="SampleProject.TabContainerSample" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc2" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>TabContainer tab not visible issue test page</title>
</head>
<body>
    <form id="form1" runat="server">
    <cc2:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc2:ToolkitScriptManager>
    <div id="mainContent">
        <asp:Label ID="lblActiveTab" runat="server"></asp:Label>
        <cc2:TabContainer runat="server" Width="100%" ID="TabContDNS" 
            ActiveTabIndex="0" OnActiveTabChanged="TabContDNS_ActiveTabChanged"
            AutoPostBack="True">
            <cc2:TabPanel runat="server" HeaderText="Tab 1" ID="Tab1">
            <ContentTemplate>
                <p>Tab 1</p>
            </ContentTemplate>
            </cc2:TabPanel>
            <cc2:TabPanel runat="server" HeaderText="Tab 2" ID="Tab2">
            <ContentTemplate>
                <p>Tab 2</p>
            </ContentTemplate>
            </cc2:TabPanel>
            <cc2:TabPanel runat="server" HeaderText="Invisible Tab" ID="Tab0" Visible="False">
            <ContentTemplate>
                <p>Tab 0 (Invisible)</p>
            </ContentTemplate>
            </cc2:TabPanel>
            <cc2:TabPanel runat="server" HeaderText="Tab 3 (after invisible tab starts here)" ID="Tab3">
            <ContentTemplate>
                <p>Tab 3</p>
            </ContentTemplate>
            </cc2:TabPanel>
            <cc2:TabPanel runat="server" HeaderText="Tab 4" ID="Tab4">
            <ContentTemplate>
                <p>Tab 4</p>
            </ContentTemplate>
            </cc2:TabPanel>
            <cc2:TabPanel runat="server" HeaderText="Tab 5" ID="Tab5">
            <ContentTemplate>
                <p>Tab 5</p>
            </ContentTemplate>
            </cc2:TabPanel>
            <cc2:TabPanel runat="server" HeaderText="Tab 6" ID="Tab6">
            <ContentTemplate>
                <p>Tab 6</p>
            </ContentTemplate>
            </cc2:TabPanel>
            <cc2:TabPanel runat="server" HeaderText="Tab 7" ID="Tab7">
            <ContentTemplate>
                <p>Tab 7</p>
            </ContentTemplate>
            </cc2:TabPanel>
            <cc2:TabPanel runat="server" HeaderText="Tab 8" ID="Tab8">
            <ContentTemplate>
                <p>Tab 8</p>
            </ContentTemplate>
            </cc2:TabPanel>
        </cc2:TabContainer>
    </div>
</form>
</body>
</html>

cs code

using System;

namespace SampleProject
{
    public partial class TabContainerSample : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //Tab0.Visible = false;
            //Tab0.Enabled = false;
        }

        protected void TabContDNS_ActiveTabChanged(object sender, EventArgs e)
        {
            lblActiveTab.Text = "Selected Tab: " + TabContDNS.ActiveTab.HeaderText;
        }
    }
}

Basically what happens is that when you set one or more tab to be invisible (no matter whether you do it by the attribute on tag declaration or in the code-behind), TabContainer starts to display mixed-content tabs after ActiveTabChanged event, when index requested is equals or greater than the one of the not visible. Issue is showing both with or without updatepanels on page.

I found no other discussion about that, except for an old one on codeplex, that describes perfectly what is happening to me. I answered to that work item and opened a new one by myself, not sure what is going on and why a very old bug is popping out again like that.

Hope someone can advice some workaround or any other useful tip.

EDIT: Bug seems to be re-introduced on December 2013 toolkit version. Anyway, I may have found a workaround to bypass the issue. Discussion is still on progress on CodePlex platform, I posted there all the details: https://ajaxcontroltoolkit.codeplex.com/workitem/27646

Asimov
  • 65
  • 7

0 Answers0