[1.2] Bug: FitLayout fails to render if in UserControl that is Loaded at runtime

  1. #1

    [1.2] Bug: FitLayout fails to render if in UserControl that is Loaded at runtime

    Test.aspx
    
    
    <%@ Page Language="C#" MasterPageFile="~/temp.master"  %>
    <%@ Register src="/Test.ascx" tagname="Test" tagprefix="uc" %> 
    <script runat="server">
        protected void Page_Load( object sender, EventArgs e ) {
            ph.Controls.Add( LoadControl( "~/Test.ascx" ) );
        } 
    </script> 
    <asp:Content ID="c" ContentPlaceHolderID="cp" Runat="Server">
        <asp:PlaceHolder ID="ph" runat="server" />
    </asp:Content>
    Temp.master
    
    <%@ Master Language="C#" AutoEventWireup="true" %> 
    <!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">
     <body>
    <form id="f" runat="server">
     <ext:ResourceManager ID="rm" runat="server" HideInDesign="true" SourceFormatting="true" CleanResourceUrl="false" /> 
    <ext:Viewport ID="vp" runat="server" MonitorResize="true" >
    <Items>
         <ext:Panel runat="server" AutoScroll="true" >
        <Content>
             <asp:ContentPlaceHolder id="cp" runat="server" />
       </Content>
        </ext:Panel>
     </Items>
    </ext:ViewPort>
    </form>
    </body>
    </html>

    Test.ascx

    
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="Test.ascx.cs" Inherits="TestCtl" %> 
    <ext:FitLayout ID="View" runat="server">
    <Items>
         <ext:Panel runat="server" Title="Test.ascx" /> 
    </Items>
    </ext:FitLayout>
    ContentControl.Add() would solve this problem, except the page cannot gain access to a Ext.Net.Container. Also if FitLayout is removed from the user control Test.ascx, everything runs fine (but layout is required).

    See below for error of rendered output
    
    Ext.onReady(function(){Ext.QuickTips.init();new Ext.net.Viewport({  id: "ctl00_vp",  renderTo: "aspnetForm",  monitorResize: true,  items: {  id: "ctl00_ctl02",  contentEl: "ctl00_ctl02_Content",  autoScroll: true},  layout: "auto"});{  id: "ctl00_cp_ctl00_ctl00",  xtype: "panel",  title: "Test.ascx"}});    //]]>
    The code above is an oversimplification.
    Last edited by michaeld; Nov 03, 2011 at 2:40 AM.
  2. #2
    Hi,

    A FitLayout can't interact with a PlaceHolder.

    You could use an <ext:Container> instead of an <asp:PlaceHolder>. Then you can use a FitLayout.
  3. #3
    Can you just add the UserControl directly into the <asp:Content> Control, instead of adding to the <asp:Placeholder>?
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] Managing events from a dynamically loaded UserControl
    By egvt in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 20, 2012, 4:49 PM
  2. Replies: 5
    Last Post: Nov 03, 2011, 2:39 AM
  3. regarding usercontrol load in runtime
    By ranjit2k99 in forum 1.x Help
    Replies: 22
    Last Post: May 30, 2011, 1:38 PM
  4. Replies: 19
    Last Post: May 18, 2011, 4:45 PM
  5. Replies: 3
    Last Post: Mar 30, 2010, 1:03 PM

Posting Permissions