Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6917975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:47:59+00:00 2026-05-27T09:47:59+00:00

When I click the add tab button, server side code ( tabs.ActiveTabIndex+=1 ) changes

  • 0

When I click the “add tab” button, server side code (tabs.ActiveTabIndex+=1) changes tabs, but the tab looks empty. If I click back and forth, I could see the user control renders. Am I missing something?

<ajaxToolkit:TabContainer ID="TabContainer1" runat="server" Height="90%" Width="100%"
        ActiveTabIndex="0" OnDemand="true" AutoPostBack="false" TabStripPlacement="Top"
        CssClass="ajax__tab_xp" ScrollBars="None" UseVerticalStripPlacement="false" VerticalStripWidth="120px">
        <ajaxToolkit:TabPanel ID="tab1" runat="server" HeaderText="1">
            <ContentTemplate>
                <uc:UCCommSubmit ID="ucCommInfo" runat="server" />
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
        <ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="" Visible="false">
            <ContentTemplate>
                <uc:UCCommSubmit ID="UCCommSubmit1" runat="server" />
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
        <ajaxToolkit:TabPanel ID="TabPanel2" runat="server" HeaderText="" Visible="false">
            <ContentTemplate>
                <uc:UCCommSubmit ID="UCCommSubmit2" runat="server" />
            </ContentTemplate>
        </ajaxToolkit:TabPanel>
    </ajaxToolkit:TabContainer>
    <div style="padding-right: 20px; float: right">
        <asp:Button ID="btnNext" runat="server" Text="Add Tab" 
            onclick="btnNext_Click" />
    </div>


protected void btnNext_Click(object sender, EventArgs e)
    {
        if (TabContainer1.Tabs.Count > TabContainer1.ActiveTabIndex + 1)
        {
            TabContainer1.Tabs[TabContainer1.ActiveTabIndex + 1].HeaderText = (TabContainer1.ActiveTabIndex + 1).ToString();
            TabContainer1.Tabs[TabContainer1.ActiveTabIndex+1].Visible = true;
            TabContainer1.ActiveTabIndex += 1;
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:48:00+00:00Added an answer on May 27, 2026 at 9:48 am

    I’m not sure if this is related but i had similar problems a few months ago. Here is the answer on SO which links to forums.asp.net that contains detailed informations: https://stackoverflow.com/a/6307930/284240

    It could also be caused by changing the ActiveTabIndex from codebehind without triggering the ActiveTabChanged event of the TabContainer.

    Try to use this javascript function onclick of your button, that causes the TabContainer to trigger this event:

    function changeActiveTab(tabContainerID,tabIndex){
        var ctrl = $find(tabContainerID);
        ctrl.set_activeTab(ctrl.get_tabs()[tabIndex]);
    }
    

    Then you can handle the event and change the visibility of your UserControls (and update UpdatePanels if necessary).

    I just noticed that i answered another similar question here on SO:

    Have you tried to set the ActiveTab-Property(from codebehind) or the ActiveTabIndex from codebehind or aspx?

    You could also check if it works if you explicitly set the display to visible:

    ActiveTabIndex="0" style="display:block;visibility:visible;"
    

    Are you sure that the Ajax libraries are loaded correctly? Do you have other Ajax-Controls inside of your TabContainer? Check if all of your html in that page is valid.

    Are you using the latest AjaxToolkit and the ToolkitScriptManager instead of the ScriptManger?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to add a click handler for a button using jQuery, but the
I'm attempting to add a .click() to a tab that I add dynamically. Code
Project: http://design.vitalbmx.com/fave/news.html When I click Add to favorites button (under main pic), in Chrome
I want to add a click able button to a MKAnnotation as seen in
At Project > Properties > Java Build Path > Libraries tab you click Add
Jquery UI tabs has an add event which is triggered immediately after a tab
I have a aspx page which has three tabs. When I click a button
When I click Add to Compare on a product, a message stating that such-and-such
Every time you start Visual Studio, the first time you click Add Reference to
I am trying to build a shopping cart site. When a user click add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.