[FIXED] Panel/Fieldset bug

  1. #1

    [FIXED] Panel/Fieldset bug

    Hi devs,

    I love your controls and use them in my application. But I found a problem. When I add a Panel or FieldSet from codebehind the panel is not showing and browser throwns a javascript error.
    "this.el.dom is null or not an object"

    Thanks in advance


    Regards,

    Ivaylo
  2. #2

    RE: [FIXED] Panel/Fieldset bug

    Do you have a ScriptManager control on the Page?

    The following samples demonstrate addeding a Panel and Fieldset from the code-behind. Examples for both version 0.4 and the soon to be released 0.5 are included.

    Example (0.4)

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Coolite.Web.UI" Namespace="Coolite.Web.UI" TagPrefix="cool" %>
    
    <!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 Page_Load(object sender, EventArgs e)
        {
            Coolite.Web.UI.Panel panel = new Coolite.Web.UI.Panel();
    
            panel.ID = "Panel1";
            panel.Title = "Panel";
            panel.Width = Unit.Pixel(400);
            panel.Height = Unit.Pixel(300);
            panel.Collapsible = true;
            panel.BodyStyle = "padding:6px;";
    
            FieldSet fieldset = new FieldSet();
            fieldset.ID = "Fieldset1";
            fieldset.Title = "Fieldset";
            fieldset.Height = Unit.Pixel(250);
            fieldset.Collapsible = true;
    
            LiteralControl div = new LiteralControl();
            div.Text = "Hello World";
    
            // Add  to Fieldset
            fieldset.ContentContainer.Controls.Add(div);
            
            // Add Fieldset to Panel
            panel.ContentContainer.Controls.Add(fieldset);
    
            // Add Panel to Form
            this.form1.Controls.Add(panel);
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <cool:ScriptManager ID="ScriptManager1" runat="server" />
        </form>
    </body>
    </html>
    Example (0.5)

    <%@ 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 Page_Load(object sender, EventArgs e)
        {
            Coolite.Ext.Web.Panel panel = new Coolite.Ext.Web.Panel();
    
            panel.ID = "Panel1";
            panel.Title = "Panel";
            panel.Width = Unit.Pixel(400);
            panel.Height = Unit.Pixel(300);
            panel.Collapsible = true;
            panel.BodyStyle = "padding:6px;";
    
            FieldSet fieldset = new FieldSet();
            fieldset.ID = "Fieldset1";
            fieldset.Title = "Fieldset";
            fieldset.Height = Unit.Pixel(250);
            fieldset.Collapsible = true;
    
            LiteralControl div = new LiteralControl();
            div.Text = "Hello World";
    
            // Add  to Fieldset
            fieldset.Items.Add(div);
            
            // Add Fieldset to Panel
            panel.Items.Add(fieldset);
    
            // Add Panel to Form
            this.form1.Controls.Add(panel);
        }
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
        </form>
    </body>
    </html>
    Hope this helps.
    Geoffrey McGill
    Founder

Similar Threads

  1. Replies: 6
    Last Post: Dec 07, 2011, 12:55 PM
  2. Max height of Panel or FieldSet?
    By dbassett74 in forum 1.x Help
    Replies: 1
    Last Post: Feb 18, 2010, 1:37 PM
  3. Replies: 4
    Last Post: Aug 19, 2009, 2:01 PM
  4. Replies: 6
    Last Post: Jan 07, 2009, 8:31 AM
  5. Replies: 1
    Last Post: Sep 16, 2008, 10:45 AM

Posting Permissions