PDA

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



michaeld
Nov 03, 2013, 12:42 PM
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.

Daniil
Nov 04, 2013, 5:49 AM
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.

Daniil
Nov 04, 2013, 7:55 AM
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.

michaeld
Nov 04, 2013, 9:19 AM
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.

Daniil
Nov 04, 2013, 11:18 AM
That makes sense. Thank you for the suggestion. We will investigate a possibility to acheive it.

Daniil
Nov 07, 2013, 4:40 AM
This case has been fixed in the SVN trunk:

<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<ext:UserControlLoader runat="server" Path="TestUC.ascx" />
</asp:Content>