Auto Resize Panel in ViewPort on client-side Panel.AutoLoad

Page 2 of 2 FirstFirst 12
  1. #11

    RE: Auto Resize Panel in ViewPort on client-side Panel.AutoLoad

    Nice to know about the '.Scripts=true' option.

    Good writeup of this feature too. I'm hungry for any additional docs...

    I think I may be able to get my scenario working in the 'merge' mode now. I'll let you know.

    Greatful for all your support,
    Randy
  2. #12

    RE: Auto Resize Panel in ViewPort on client-side Panel.AutoLoad

    My goal is to have some samples and all code*(tentatively)*impletemented*before the end of the weekend.*

    Geoffrey McGill
    Founder
  3. #13

    RE: Auto Resize Panel in ViewPort on client-side Panel.AutoLoad

    Hi Randy,

    I've added a new property called <AutoLoad2> for your testing purposes. The property will be renamed to just <AutoLoad> once we finish testing.

    At this point I haven't been able to put together a more involved example, but I did convert your original sample and tightened things up.

    Example (Parent)

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Button1_Click(object sender, AjaxEventArgs e)
        {
            LoadConfig2 config = new LoadConfig2("Child.aspx");
            config.Params.Add(new Coolite.Ext.Web.Parameter("value", "5"));
            config.Params.Add(new Coolite.Ext.Web.Parameter("text", "Five"));
            config.Callback = "ViewPort1.syncSize();";
            this.Panel1.Load2(config);
        }
    </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 id="Head1" runat="server">
        <title></title>
        <script type="text/javascript">
            var ComboBox1_Select = function(el) {
                console.log(el);
                Panel1.load({
                    url: "Child.aspx",
                    params: el.getSelectedItem(),
                    callback: function() { ViewPort1.syncSize(); }
                });
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager" runat="server" />
            <ext:ViewPort ID="ViewPort1" runat="server">
                <Body>
                    <ext:BorderLayout ID="BorderLayout1" runat="server">
                        <North Collapsible="True" Split="True">
                            <ext:Panel 
                                ID="Panel1" 
                                runat="server"
                                AutoHeight="true" 
                                Title="North"
                                BodyStyle="padding:6px;">
                                <AutoLoad2 Url="Child.aspx" Callback="ViewPort1.syncSize();">
                                    <Params>
                                        <ext:Parameter Name="Text" Value="InitLoad" />
                                        <ext:Parameter Name="Count" Value="2" />
                                    </Params>
                                </AutoLoad2>
                                <Buttons>
                                    <ext:Button ID="Button1" runat="server" Text="Add Five(5) Rows" Icon="Add">
                                        <AjaxEvents>
                                            <Click OnEvent="Button1_Click" />
                                        </AjaxEvents>
                                    </ext:Button>
                                </Buttons>
                            </ext:Panel>
                        </North>
                        <Center>
                            <ext:Panel 
                                ID="Panel2" 
                                runat="server" 
                                Title="Center" 
                                BodyStyle="padding:6px;">
                                <Body>
                                    <ext:FormLayout ID="FormLayout1" runat="server">
                                        <ext:Anchor>
                                            <ext:ComboBox 
                                                ID="ComboBox1" 
                                                runat="server" 
                                                FieldLabel="Number of Rows">
                                                <Items>
                                                    <ext:ListItem Text="One" Value="1" />
                                                    <ext:ListItem Text="Two" Value="2" />
                                                    <ext:ListItem Text="Four" Value="4" />
                                                    <ext:ListItem Text="Six" Value="6" />
                                                    <ext:ListItem Text="Eight" Value="8" />
                                                </Items>
                                                <Listeners>
                                                    <Select Fn="ComboBox1_Select" />                      
                                                </Listeners>
                                            </ext:ComboBox>
                                        </ext:Anchor>
                                    </ext:FormLayout>
                                </Body>
                            </ext:Panel>
                        </Center>
                    </ext:BorderLayout>
                </Body>
            </ext:ViewPort>
        </form>
    </body>
    </html>
    Example (Child)

    <%@ Page Language="C#" %>
     <script type="text/C#" runat="server">
        protected void Page_Init(object sender, EventArgs e)
        {
            string text = !string.IsNullOrEmpty(Request.Params["text"]) ? Request.Params["text"] : "NoText" ;
            int count = int.Parse(!string.IsNullOrEmpty(Request.Params["value"]) ? Request.Params["value"] : "3" );
    
            string msg = string.Format("Selection=[{0}]", text);
    
            for (int i = 0; i < count; i++)
            {
                HtmlGenericControl div = new HtmlGenericControl("div");
                div.InnerText = msg;
    
                this.Controls.Add(div);
            }
        }
    </script>
    I'll be continueing to work on the .AutoLoad/AutoLoad2 property over the next couple days.

    Hope this helps.

    Geoffrey McGill
    Founder
  4. #14

    RE: Auto Resize Panel in ViewPort on client-side Panel.AutoLoad



    Geofrey;

    Your AutoLoad2 example seems work and fixes the sizing issue.

    However, when I went to add actuall controls to the Child I ran into problems.

    The Child.aspx code below has two test variables 'useCoolite' and 'nonCooliteTest'.

    1) With 'useCoolite' true, the Child page is rendered right initially, but when I go to pull down the ComboBox I get a JS Exceptition

    2) With 'useCoolite' false, 'nonCooliteTest' #0 &amp; #2 work fine, but #1 seems to cause the Child page to never load (the load mask never goes away).

    Let me know if there are other code changes and I will test them a bit more.

    -Randy


    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Child.aspx.cs" Inherits="Child" %>
    
    
    <!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></title>
      <script type="text/C#" runat="server">
        protected void Page_Init(object sender, EventArgs e)
        {
          string text = !string.IsNullOrEmpty(Request.Params["text"]) ? Request.Params["text"] : "NoText" ;
          int count   = int.Parse(!string.IsNullOrEmpty(Request.Params["value"]) ? Request.Params["value"] : "3" );        
    
    
          int   nonCooliteTest=1;
          bool  useCoolite = true;
          if(useCoolite)
          {
            Coolite.Ext.Web.ScriptManager sm = new Coolite.Ext.Web.ScriptManager();
            _body.Controls.Add(sm);
          }
    
    
          string msg = string.Format("Selection=[{0}]", text);        
          for (int i = 0; i < count; i++)
          {
            HtmlGenericControl div = new HtmlGenericControl("div");
            _body.Controls.Add(div);
    
    
            if(useCoolite){
              Coolite.Ext.Web.Button btn = new Coolite.Ext.Web.Button();
              btn.Text = msg;
              div.Controls.Add(btn);
            }
            else
            {
              switch(nonCooliteTest)
              {
                case 0 : div.InnerText = msg; break;
                case 1 :
                {
                  System.Web.UI.WebControls.Button btn = new System.Web.UI.WebControls.Button();
                  btn.Text = msg;
                  div.Controls.Add(btn);
                } break;
                case 2 :
                {
                  System.Web.UI.WebControls.Label lbl = new System.Web.UI.WebControls.Label();
                  lbl.Text = msg;
                  div.Controls.Add(lbl);
                } break;
              }
            }
          }    
        }
      </script>
    </head>
    <body id="_body" runat="server"></body>
    </html>
Page 2 of 2 FirstFirst 12

Similar Threads

  1. [CLOSED] Resize Region in ViewPort via client-script
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 24, 2011, 7:17 PM
  2. Problem in Enable panel on client side
    By Rupesh in forum 1.x Help
    Replies: 1
    Last Post: Dec 15, 2010, 2:44 PM
  3. Replies: 1
    Last Post: Jun 10, 2010, 11:28 AM
  4. Set Panel Icon Client Side
    By Tbaseflug in forum 1.x Help
    Replies: 2
    Last Post: Apr 29, 2009, 2:21 PM
  5. [CLOSED] Auto Resize of North Panel in ViewPort on Panel.AutoLoad
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 19, 2008, 12:13 AM

Posting Permissions