[CLOSED] Page with MasterPageFile with nothing in the Content but a UserControlLoader does not layout children

  1. #1

    [CLOSED] Page with MasterPageFile with nothing in the Content but a UserControlLoader does not layout children

    This does not display:
    <Master>
      <ViewPort layout="Fit">
         <Panel layout="VBox">
            <ContentPlaceholder>
               <UserControlLoader Path="/usercontrol.ascx">
    
                  <-- Usercontrol.ascx -->
                  <Panel Flex="1">
                     ...
    To get the UserControl Panel to display, the UserControl must be wrapped in a Container with Layout="Fit". Intuition would suggest this should have worked without having another layer in between. Let me know if my intuition is incorrect, and if so, why? Thanks.
    Last edited by Daniil; Nov 12, 2013 at 9:18 AM. Reason: [CLOSED]
  2. #2
    Hi @michaeld,

    Have I got your scenario correctly?

    Master Page
    <%@ Master Language="C#" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
    
        <ext:Viewport runat="server" Layout="FitLayout">
            <Items>
                <ext:Panel runat="server" Layout="VBoxLayout">
                    <Content>
                        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" />
                    </Content>
                </ext:Panel>
            </Items>
        </ext:Viewport>
    </body>
    </html>
    Content Page
    <%@ Page Language="C#" MasterPageFile="~/Site1.Master" %>
    
    <asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <ext:UserControlLoader runat="server" Path="TestUC.ascx" /> 
    </asp:Content>
    User Control
    <%@ Control Language="C#" %>
    
    <ext:Panel runat="server" Flex="1" Title="Panel 1" />
    
    <ext:Panel runat="server" Flex="1" Title="Panel 2" />
    It also "doesn't work" with this content page.

    Content Page Case 2
    <%@ Page Language="C#" MasterPageFile="~/Site1.Master" %>
    
    <asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <ext:Panel runat="server" Flex="1" Title="Panel 1" />
    
        <ext:Panel runat="server" Flex="1" Title="Panel 2" />
    </asp:Content>
    Well, I wrote "doesn't work" in quotes, because I am not sure there is a good possibility to get it working. Though, we will investigate.
  3. #3
    The fix has been committed to SVN. Now this
    <asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <uc:TestUC runat="server" />
    </asp:Content>
    and
    <asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <ext:Panel runat="server" Flex="1" Title="Panel 1" />
    
        <ext:Panel runat="server" Flex="1" Title="Panel 2" />
    </asp:Content>
    works, but this
    <asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <ext:UserControlLoader runat="server" Path="TestUC.ascx" />    
    </asp:Content>
    doesn't.

    A UserControlLoader must be used only inside an Items collection of any Ext.NET container.
  4. #4
    Quote Originally Posted by Daniil View Post
    The fix has been committed to SVN.
    A UserControlLoader must be used only inside an Items collection of any Ext.NET container.
    Oh good. I'm glad that was enough to give you insight into a real problem, and that there was some form of solution. I didn't actually create a sample because even though I tried some of the variations you indicated trying, I didn't have the time to share every observation because I was trying a few things much at the same-time. It turned out I didn't need to do it the way I shared with you so I moved on. However, I thought it was important enough to draw attention to the situation so Ext.Net couldn't continue to stabilize under multiple real-world scenarios.

    And what you're saying about UserControlLoader not working there makes sense.

    I'm bound right now to using the CDN so I'm locked to 2.3.1 for awhile unless there's something really serious found that forces me off. I can branch small cs changes to test but it's slightly riskier pushing to production. This should be a safe branch that I can lock onto though if I decide I need to do it this way again. Good job guys.



    Though, let me ask something of a feature request? Is there any reason UserControlLoader can't be made to be more versatile so that it can load in content collection as well as an items collection? Maybe with an attribute Contents="true" or something? It's pretty nice being able to just specify the path in the control without being forced to register controls at the top of the page, especially true when the path attribute is dynamic and read from a database. That would be one-up on dotNet. I realize it can already be done with Page.LoadControl to a placeholder or a added to the Controls of a parent, but not as simply as just setting the Path attribute of a control in the presentation-layer like you can with UserControlLoader.
    Last edited by michaeld; Nov 05, 2013 at 1:56 AM.
  5. #5
    That makes sense. Thank you for the suggestion. We will investigate a possibility to acheive it.
  6. #6
    This case has been fixed in the SVN trunk:
    <asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <ext:UserControlLoader runat="server" Path="TestUC.ascx" />
    </asp:Content>

Similar Threads

  1. [CLOSED] Force layout of Button's children
    By RCN in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 29, 2012, 8:51 AM
  2. [CLOSED] UserControlLoader and Content
    By thchuong in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 11, 2012, 8:03 AM
  3. Replies: 0
    Last Post: Jul 30, 2012, 10:39 AM
  4. Replies: 4
    Last Post: Nov 03, 2011, 6:46 PM
  5. Replies: 2
    Last Post: May 05, 2010, 10:23 AM

Posting Permissions