[CLOSED] Adding a New Tab to TabPanel

  1. #1

    [CLOSED] Adding a New Tab to TabPanel

    Hello

    I am not able to add new tab to a tabpanel, Here is the simplied Code, please tell me what am i missing??
    also, Can i add a new tab of type "ext:Window" autoLoad with a URL ??

    Thanks

    TabPanel.aspx
    <%@ Page Title="" Language="VB" AutoEventWireup="false" CodeFile="TabPanel.aspx.vb" Inherits="TabPanel" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" 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 id="Head1" runat="server">
    <title>Ext.NET Example</title>    
    </head>
    <body>
        <form runat="server" >
        <ext:ResourceManager ID="ResourceManager1" runat="server" ScriptMode="Debug" />
    
        <ext:TabPanel ID="myTabPanel" runat="server" Width="450">
            <Items>
                <ext:Panel ID="first" runat="server" Html="First Tab" Title="First" AutoHeight="true" Padding="6" />
                <ext:Panel ID="Second" runat="server" Html="Second tab" Title="Second" AutoHeight="true"  Padding="6"/>
            </Items>    
        </ext:TabPanel>
        
        <ext:Panel ID="newTab" runat="server" Title="RFC Details" AutoHeight="true" Hidden="true">
            <Content>
                This is the newly added tab
            </Content>        
        </ext:Panel>
    
        <ext:Button runat="server" ID="btnAddTab" Text="Add new Tab" StyleSpec="margin-left:10px;padding-top:50px;"  >
            <DirectEvents>
                <Click OnEvent="AddTab" />
            </DirectEvents>
        </ext:Button>
    </form>
    </body>
    </html>
    TabPanel.aspx.vb
    Imports Ext.Net
    
    Partial Class TabPanel
        Inherits System.Web.UI.Page
    
        Protected Sub AddTab(ByVal sender As Object, ByVal e As DirectEventArgs)
    
            'Add the window to the tab
            Me.myTabPanel.Items.Add(Me.newTab)
            Me.myTabPanel.SetActiveTab(2)
            Me.myTabPanel.Reload()
    
        End Sub
    End Class
    Last edited by geoffrey.mcgill; Feb 02, 2011 at 5:23 PM. Reason: [CLOSED]
  2. #2
    Have you checked the examples?
    http://examples1.ext.net/#/TabPanel/Basic/Add_Tabs/

    hth /Peter
  3. #3
    Hi all,

    Thank Peter, this example can help to @ndotis.

    Also please look at the example how we can add a new tab during DirectEvent/DirectMethod.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void TestDirectEventHandler(object sender, DirectEventArgs e)
        {
            var t = new Ext.Net.Panel()
            {
                Title = "New tab",
                ID = "NewTabID",
                Html = "Tab1's content"
            };
            t.AddTo(this.TabPanel1);
            this.TabPanel1.SetActiveTab(t.ClientID);
        }
    </script>
    
    <!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>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:TabPanel ID="TabPanel1" runat="server" Height="200">
            <Items>
                <ext:Panel runat="server" Title="Tab1" Html="Tab1's content" />
                <ext:Panel runat="server" Title="Tab2" Html="Tab1's content" />
            </Items>
        </ext:TabPanel>
        <ext:Button runat="server" Text="Add new tab" OnDirectClick="TestDirectEventHandler" />
        </form>
    </body>
    </html>
  4. #4
    Yes, it worked great, trick was, add the new Panel/component to the tabPanel not the otherway around.
    Thanx, mark this solved.
  5. #5
    Hi Sir,

    I am facing same Scenario just difference is that

    I have Kept TabPanel in assume Home.aspx

    and i want to add another tab on cell click of grid Which present in Page2.aspx

    So can you provide me solution

    like what should i'll write instead of

    "this.TabPanel1"

    As above Problem that you have solved.
  6. #6
    Hi @Roshan,

    Please start a new forum thread. If you feel the threads are related, please feel free to cross link between the two.
  7. #7
    Hi Sir

    Sir I don't have enough Privileges to start new forum
    Because of that am requesting you if possible please ans me on this thread .

    Thanks
  8. #8
    Use the Community Forums

    Thanks /Peter

Similar Threads

  1. [CLOSED] ext:TabPanel: adding controls in JavaScript.
    By supera in forum 2.x Premium Help
    Replies: 7
    Last Post: Apr 26, 2012, 4:44 PM
  2. Adding 2 idetical tabs on the same TabPanel
    By ozayExt in forum 1.x Help
    Replies: 5
    Last Post: Aug 22, 2011, 5:12 PM
  3. Problems adding tab to tabpanel
    By xxjt123xx in forum 1.x Help
    Replies: 0
    Last Post: Mar 02, 2011, 10:55 PM
  4. Replies: 2
    Last Post: Oct 22, 2010, 7:20 AM
  5. TabPanel error on adding tab
    By sz_146 in forum 1.x Help
    Replies: 0
    Last Post: Jan 09, 2009, 9:01 AM

Tags for this Thread

Posting Permissions