[CLOSED] Can't add dynamically a button to a panel

  1. #1

    [CLOSED] Can't add dynamically a button to a panel

    Coolite.Ext.Web.Panel panel1 = new Coolite.Ext.Web.Panel(); 
    panel1.ID = "Panel1";
    panel1.Title = "Panel 1";
    panel1.Border = false;
    panel1.BodyStyle = "padding:6px;";
    panel1.Icon = Icon.FolderGo;
    
    Coolite.Ext.Web.Button button1 = new Coolite.Ext.Web.Button();
    button1.Text = "Button";
    
    //panel1.Controls.Add(button1);
    panel1.Items.Add(button1);
    (After that, I add panel1 to a accordion menu)

    I've tried with panel1.Controls.Add and panel1.Items.Add (what is the difference?), but the button doesn't show when I run the application.

    Do you know why it isn't working?

    Thanks!
  2. #2

    RE: [CLOSED] Can't add dynamically a button to a panel

    Behind door #3 you'll find the .ContentControls Collection. Yes, it's a bit confusing and deciding which collection to use is determined by what you're doing.

    In general both the .Controls and .Items Collections/Properties would not used (at least publicly) with the Coolite Toolkit. If you just want to add content to the Panel body, you must add to the <Content> template, which is exposed by the .ContentControls Collection.

    The following sample demonstrates adding a Control to the <Content> template of the Panel.

    panel1.ContentControls.Add(button1);
    Hope this helps.
    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] Can't add dynamically a button to a panel



    Yes, it helps a lot, thanks!

    Another question... If I add an icon to the panel (panel1.Icon = Icon.FolderGo; ) I see the icon if I run the application in IE 6 or 7, but it doesn't show if I run it in Firefox 3. It is a bug or I'm doing something wrong?

    By the way, I would like to read some Coolite documentation to learn more and not make so stupid questions, there is something I can read?

    Thanks!
  4. #4

    RE: [CLOSED] Can't add dynamically a button to a panel

    Hi LuB,

    Can you provide a Panel sample which does not work in FF3? I develop almost exclusively now in FF3 and have not noticed any issues. The following sample demonstrates a simple <ext:Panel> that I tested with the .Icon property set.

    Example

    <ext:Panel 
        ID="Panel1" 
        runat="server" 
        Height="300" 
        Width="600" 
        Title="Title"
        Icon="FolderGo"
        Html="Icon Test Panel"
        />
    Unfortunately the Coolite Toolkit documentation is not available yet. The full ExtJS documentation is available online.

    Hope this helps.
    Geoffrey McGill
    Founder
  5. #5

    RE: [CLOSED] Can't add dynamically a button to a panel



    Yeah, it's working now. I think I was doing something wrong.

    Thanks for everything.

Similar Threads

  1. [CLOSED] Need a remove button for a dynamically created FileUpload control
    By wisdomchuck in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: May 22, 2012, 1:40 PM
  2. Replies: 0
    Last Post: Mar 27, 2012, 10:01 AM
  3. [CLOSED] Dynamically generate button and button menu problem.
    By csssi_coolite in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Dec 22, 2011, 5:02 AM
  4. Replies: 0
    Last Post: Apr 07, 2011, 8:48 PM
  5. [CLOSED] [1.0] Dynamically format GridCommand cell and button
    By betamax in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jan 19, 2011, 6:19 PM

Posting Permissions