[ADDED] [V0.6] TabPanel

  1. #1

    [ADDED] [V0.6] TabPanel

    Hello,

    Can we get the following:

    TabPanel.ActiveTab renamed to TabPanel.ActiveIndex (or ActiveTabIndex)

    and

    TabPanel.ActiveTab to return the Tab object or null if not selected?

    I really dislike having to do:

    ...
    if (Tabs1.ActiveTab.Equals(Tab1.TabIndex)) {
    
    }
    ...
    Microsoft ASP.NET use this idea in asp:MultiView and asp:View ;)

    Cheers,
    Timothy
  2. #2

    RE: [ADDED] [V0.6] TabPanel

    Hi Timothy,

    The data type and functionality of the ActiveTab property has bothered me as well.

    I've added a new .ActiveTabIndex [int] property and changed the .ActiveTab property to get/set a Tab object.

    NOTE: THIS IS A BREAKING CHANGE FOR V0.6, see http://forums.ext.net/showthread.php...1404-12-1.aspx.

    The .ActiveTabIndex is zero based, therefore the first tab in the .Tabs collection has the index of '0'.

    The follow code sample demonstrates using markup to set the ActiveTabIndex to the second <ext:Tab>.

    Example

    <ext:TabPanel ID="TabPanel1" runat="server" ActiveTabIndex="1" Title="Title">
        <tabs>
            <ext:Tab ID="Tab1" runat="server" Title="Tab 1" />
            <ext:Tab ID="Tab2" runat="server" Title="Tab 2" />
        </tabs>
    </ext:TabPanel>
    The following sample demonstrates setting the .ActiveTabIndex from the <Click> AjaxEvent of an <ext:Button>.

    Example

    <%@ Page Language="C#" %>
    
    <%@ 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">
    
    <script runat="server">
        protected void Button1_Click(object obj, AjaxEventArgs e)
        {
            this.TabPanel1.ActiveTabIndex = 1;
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Coolite Toolkit : Setting the .ActiveTabIndex on an AjaxEvent</title>
    </head>
    <body>
        <p><a href="ActiveTabIndex.aspx">Reload</a></p>
        <form id="Form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            <ext:TabPanel ID="TabPanel1" runat="server" Height="300">
                <Tabs>
                    <ext:Tab ID="Tab1" runat="server" Title="Tab 1" Html="Tab 1" />
                    <ext:Tab ID="Tab2" runat="server" Title="Tab 2" Html="Tab 2" />
                </Tabs>
            </ext:TabPanel>
            
            <ext:Button ID="Button1" runat="server" Text="Submit">
                <AjaxEvents>
                    <Click OnEvent="Button1_Click" />
                </AjaxEvents>
            </ext:Button>
        </form>
    </body>
    </html>
    Hope this helps.

    Geoffrey McGill
    Founder
  3. #3

    RE: [ADDED] [V0.6] TabPanel

    Awesome! Thanks so much Geoffrey! :)

    Timothy

Similar Threads

  1. Replies: 12
    Last Post: Jun 04, 2012, 11:18 AM
  2. Tabs are not added to tabPanel
    By Vaishali in forum 1.x Help
    Replies: 26
    Last Post: Feb 21, 2012, 8:13 AM
  3. Replies: 4
    Last Post: Jul 01, 2010, 1:49 AM
  4. Replies: 3
    Last Post: Aug 21, 2009, 2:24 PM

Posting Permissions