[CLOSED] Dynamically create Ext: Tab at runtime.

  1. #1

    [CLOSED] Dynamically create Ext: Tab at runtime.

    Hi Coolite Team,

    I just started out exploring the toolkit and I was wondering if there's a way to dynamically creating a new tab when an ASP LinkButton control is clicked(server-side).

    I was playing with the ViewPort sample found here and I wanted to add an ASP LinkButton inside the Navigation panel and when it's clicked, I would create a new tab inside the <Center> of ViewPort by invoking this event:

       protected void LinkButton1_Click(object sender, EventArgs e)
            {
                Tab fees = new Tab();
                fees.Closable = true;
                fees.Title = "Fees";
                fees.AutoLoad = "Fees.aspx";
    
                center.Items.Add(fees);
            }
  2. #2

    RE: [CLOSED] Dynamically create Ext: Tab at runtime.

    Hi admiral,

    Welcome aboard!

    Inside the <Center> region you would need to first add a <ext:TabPanel> control, then add you Tab to the TabPanel.

    The following sample demonstrates how to dynamically add a TabPanel and Tab to the Center region of a ViewPort.

    Example

    // Make TabPanel
    TabPanel tp= new TabPanel();
    tp.ID = "CenterPanel";
    tp.ActiveTab = 0;
    
    // Make Tab
    Tab tab1 = new Tab();
    tab1.ID = "Tab1";
    tab1.Title = "Close Me";
    tab1.Closable = true;
    tab1.Border = false;
    tab1.BodyStyle = "padding:6px;";
    tab1.Html = "Hello...";
    
    // Add Tab to TabPanel
    tp.Tabs.Add(tab1);
    
    // Add TabPanel to the <Center> region
    layout.Center.Items.Add(tp);
    The above code was based on the Complex BorderLayout sample available at the following location, see http://sandbox.ext.net/Layout/Border...lexLayout.aspx.

    Hope this helps.
    Geoffrey McGill
    Founder & CEO

Similar Threads

  1. Replies: 1
    Last Post: May 09, 2012, 8:08 PM
  2. create direct event in runtime to MenuItem
    By elbanna23 in forum 1.x Help
    Replies: 7
    Last Post: Jan 10, 2012, 2:12 PM
  3. create event for gridpanel at runtime
    By kyawthura.mr in forum 1.x Help
    Replies: 4
    Last Post: Aug 10, 2011, 10:20 AM
  4. Replies: 1
    Last Post: May 27, 2011, 12:39 PM
  5. [CLOSED] Create Controls at Runtime
    By rnachman in forum 1.x Premium Help
    Replies: 3
    Last Post: Feb 24, 2011, 7:32 PM

Posting Permissions