TabPanel TabChange event not updating active tab index?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [0.8] TabPanel TabChange event not updating active tab index?

    I'm having an issue with the following code:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CooliteTesting._Default" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <ext:ScriptManager ID="extScriptManager" runat="server" />
    </body>
    </html>
    And the code behind:

        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                ViewPort viewPort = new ViewPort();
                viewPort.ID = "mainViewPort";
    
                RowLayout rowLayout = new RowLayout();
                rowLayout.ID = "mainRowLayout";
    
                LayoutRow row1 = new LayoutRow();
                row1.RowHeight = 0.5M;
    
                TabPanel tabPanel = new TabPanel();
                tabPanel.Title = "Tab Panel";
                tabPanel.AjaxEvents.TabChange.Event += TabPanel_Change;
    
                Tab tab1 = new Tab();
                tab1.Title = "Tab 1";
    
                Tab tab2 = new Tab();
                tab2.Title = "Tab 2";
    
                Tab tab3 = new Tab();
                tab3.Title = "Tab 3";
    
                tabPanel.Tabs.Add(tab1);
                tabPanel.Tabs.Add(tab2);
                tabPanel.Tabs.Add(tab3);
                row1.Items.Add(tabPanel);
    
                LayoutRow row2 = new LayoutRow();
                row2.RowHeight = 0.5M;
    
                Panel panel = new Panel();
                panel.Title = "Panel";
    
                row2.Items.Add(panel);
    
                rowLayout.Rows.Add(row1);
                rowLayout.Rows.Add(row2);
    
                viewPort.Items.Add(rowLayout);
    
                Page.Controls.Add(viewPort);
            }
    
            private void TabPanel_Change(object sender, AjaxEventArgs e)
            {
                TabPanel tabPanel = (TabPanel)sender;
                int activeTabIndex = tabPanel.ActiveTabIndex; // Always 0
            }
        }
    Any ideas?
    Last edited by riverspiv; Oct 16, 2010 at 1:27 PM.
  2. #2
    This is really frustrating...can anybody help with this? The TabChange event fires like it should, but the active tab is always the first one. How can this be? I tried setting AutoPostBack = true on the TabPanel, but all that succeeded in doing was disabling the changing of the tabs at all.

    This has to be a simple fix -- some property I'm not setting? I'm really at a loss on how to fix this...


    Also, I am looking for a code behind solution.
  3. #3
    Hi,

    You have no ASP.NET form therefore there is no automatic submit
  4. #4
    Quote Originally Posted by Vladimir View Post
    Hi,

    You have no ASP.NET form therefore there is no automatic submit
    I knew it was something simple I was overlooking. I got it working now, thanks!

Similar Threads

  1. Replies: 6
    Last Post: Oct 13, 2011, 11:55 AM
  2. TabPanel load panel in TabChange
    By naina in forum 1.x Help
    Replies: 1
    Last Post: Aug 02, 2011, 3:43 PM
  3. [CLOSED] [1.0] TabPanel - Solution for no TabChange on Page_Load
    By bsnezw in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 06, 2010, 4:27 PM
  4. Replies: 2
    Last Post: Apr 25, 2010, 2:15 AM
  5. [CLOSED] CardLayout Active Index Layout Prob
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jan 25, 2010, 4:28 PM

Posting Permissions