Autosize GridPanel inside UserControl

  1. #1

    Autosize GridPanel inside UserControl

    I'm having problem with autosize (height) of a gridpanel inside a UserControl.

    Default.aspx:
    
    
    
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="CooliteDemo._Default" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Register src="WebUserControl1.ascx" tagname="WebUserControl1" tagprefix="uc1" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title></title>
    </head>
    <body>
    
    
    <form id="form1" runat="server">
    <ext:ScriptManager ID="ExtScriptMan" runat="server"></ext:ScriptManager>
    
    <ext:ViewPort ID="ViewPort1" runat="server">
    <Content>
    <ext:BorderLayout ID="BorderLayout1" runat="server">
    
    <North Collapsible="True" Split="True">
         <ext:Panel ID="Panel1" runat="server" Height="100" Title="North">
             <Content>NorthPanel</Content>
         </ext:Panel>
    </North>
    
    
    <Center>
    <ext:Panel ID="Panel7" runat="server" Title="Center" BodyStyle="background-color:#005edd;">
       <Content>
             <%--<ext:FitLayout ID="FitLayout1" runat="server">--%>
                 <uc1:WebUserControl1 ID="WebUserControl11" runat="server" />
             <%--</ext:FitLayout>--%>
        </Content>
    </ext:Panel>
    </Center>
    
    </ext:BorderLayout>
    </Content>
    </ext:ViewPort>
    
    
    
    
    
    </form>
    
    
    </body>
    
    
    </html>
    And the UserControl:

    
    
    
    <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="WebUserControl1.ascx.vb" Inherits="CooliteDemo.WebUserControl1" %>
    
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    
    <ext:Store ID="Store1" runat="server"></ext:Store>
    
    
    <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1">
    <ColumnModel>
    <Columns>
    <ext:Column Header="Test1" Width="200"></ext:Column>
    <ext:Column Header="Test2" Width="200"></ext:Column>
    <ext:Column Header="Test3" Width="200"></ext:Column>
    <ext:Column Header="Test4" Width="200"></ext:Column>
    <ext:Column Header="Test5" Width="200"></ext:Column>
    </Columns>
    </ColumnModel>
    </ext:GridPanel>
    
    
    </ext:Panel>
  2. #2

    RE: Autosize GridPanel inside UserControl

    Hi petlun,

    If you add the <ext:FitLayout> to your "WebUserControl1" usercontrol your sample should work.


    Example


    <ext:FitLayout runat="server">
    	<ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" />
    
    </ext:FitLayout>

    Hope this helps.


    Geoffrey McGill
    Founder
  3. #3

    RE: Autosize GridPanel inside UserControl

    I'v tried that. but it gives me javscript error related to the Store.

    "WebUserControl11_Store1 is undefined"


    I'm using version 0.6 by the way.


    UserControl:


    <ext:Store ID="Store1" runat="server"></ext:Store>
    <ext:FitLayout ID="FitLayout1" runat="server">
     <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1">
       <ColumnModel>
         <Columns>
           <ext:Column Header="Test1" Width="200"></ext:Column>
           <ext:Column Header="Test2" Width="200"></ext:Column>
           <ext:Column Header="Test3" Width="200"></ext:Column>
           <ext:Column Header="Test4" Width="200"></ext:Column>
           <ext:Column Header="Test5" Width="200"></ext:Column>
         </Columns>
       </ColumnModel>
     </ext:GridPanel>
    </ext:FitLayout>

  4. #4

    RE: Autosize GridPanel inside UserControl

    I had the same problem... with the store...
    but i put the store inside a FitLayout.. and Works...

    FitLayout1.Controls.Add(store)

    Bye.

Similar Threads

  1. [CLOSED] Dynamic GridPanel - AutoSize every column?
    By vaultview in forum 1.x Legacy Premium Help
    Replies: 27
    Last Post: Mar 12, 2013, 1:37 PM
  2. Replies: 8
    Last Post: Feb 15, 2012, 9:04 AM
  3. Help! usercontrol do't autosize
    By st.leo in forum 1.x Help
    Replies: 2
    Last Post: Nov 15, 2010, 6:27 AM
  4. Help with UserControl inside window
    By dbassett74 in forum 1.x Help
    Replies: 0
    Last Post: May 26, 2009, 4:25 PM
  5. How to have scripts inside UserControl?
    By dbassett74 in forum 1.x Help
    Replies: 3
    Last Post: May 17, 2009, 6:14 PM

Posting Permissions