[2.0 rc1] Control with type 'Ext.Net.XScript' cannot be handled by layout

Page 1 of 2 12 LastLast
  1. #1

    [2.0 rc1] Control with type 'Ext.Net.XScript' cannot be handled by layout

    from http://forums.ext.net/showthread.php...in-usercontrol


    This error appears in the following situation in Test1.aspx

    main.master
    --Ext.Panel Layout="FitLayout"
    ----Content
    ------ContentPlaceHolder id="cp"

    Test1.aspx
    --Content ContentPlaceHolderID="cp"
    ----ext:XScript
    ------script

    Test2.aspx
    --Content ContentPlaceHolderID="cp"
    ----script

    Test2.aspx works. Test1 gives the error in the title.
    Last edited by michaeld; Jul 02, 2012 at 2:30 AM.
  2. #2
    Same error happens if you include a user control in the content of a panel.
    Same error happens if you use UserControlLoader to load a user control from items in a panel.
  3. #3
    Just remove Layout from Panel, if your user control contains non layout controls then Layout should not be set
  4. #4
    Quote Originally Posted by Vladimir View Post
    Just remove Layout from Panel, if your user control contains non layout controls then Layout should not be set
    The controls contain layout controls that's why I had the Layout there.

    Here's a better example...

    main.master
    --Ext.Panel Layout="VBoxLayout"
    ----Content
    ------ContentPlaceHolder id="cp"

    Test1.aspx
    --Content ContentPlaceHolderID="cp"
    ----style
    ----ext:XScript
    ------script
    ----ext:Panel Flex=1
    ----ext:Panel Flex=1
    ----ext:Window


    User controls are built the same way. Typically I build my user controls as self-contained modules that contain all of their clientside components in one file: style, javascript, the control, its children, and any modal windows or hidden controls that are shown or triggered clientside by that control.

    Is this even possible anymore? Before I could use a FitLayout or VBoxLayout to wrap the panels in the user control. And as I said, this problem occurs with UserControlLoader as well. Basically this mean XScript cannot be used in complex user controls.

    It would really be nice if you guys had a user example for this in the demos.
  5. #5

    I deem this limitation with XScript to be a defect or bug.

    I decided to build you guys a real example that shows a legitimate usage of the product that should work.

    TestControl.aspx
    <%@ Page Language="C#" %>
    <%@ Register src="Test1.ascx" tagname="TTest1" tagprefix="sc" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
    </script>
    <ext:ResourceManager ID="R1" runat="server" />
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
     <title></title>
    </head>
    <body>
    <ext:Viewport ID="P" runat="server" Layout="VBoxLayout" Title="Outter">
    <LayoutConfig>
     <ext:VBoxLayoutConfig Align="Stretch" />
    </LayoutConfig>
    <Content>
     <sc:TTest1 runat="server" />
    </Content>
    </ext:Viewport>
    
    </body>
    </html>
    Test1.ascx
    
    <%@ Control Language="C#" ClassName="TTest1" %>
    <script runat="server">
    </script>
    
    <ext:XScript ID="XScript1" runat="server" />
    
     <ext:Panel ID="P1" runat="server" Flex="1" Title="Panel1">
     <Items>
      <ext:Label Text="Test" />
     </Items>
     </ext:Panel>
     <ext:Panel ID="P2" runat="server" Flex="1" Title="Panel1">
     <Items>
     </Items>
     </ext:Panel>
    <ext:Window ID="W" runat="server" Title="Title" Modal="true"  />
    The only way to get this code to run is remove the XScript from the control. Unfortunately, this limitation is going to cause me to have to go back to 1.4.
  6. #6
    Hi,

    Well, it is impossible to implement the same in v1.4 as well. In v1.4 the VBoxLayout setting will be just ignored and the user control items won't participate in the layout logic.

    This is how you can achieve the requirement using Ext.NET v2.

    Example Page
    <%@ Page Language="C#" %>
    
    <%@ Register Src="TestUC.ascx" TagName="TestUC" TagPrefix="uc" %>
    
    <!DOCTYPE html />
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:Viewport runat="server" Layout="VBoxLayout">
            <LayoutConfig>
                <ext:VBoxLayoutConfig Align="Stretch" />
            </LayoutConfig>
            <Items>
                <ext:UserControlLoader runat="server" Path="TestUC.ascx" />
            </Items>
        </ext:Viewport>
    </body>
    </html>
    Example User Control
    <%@ Control Language="C#" %>
    
    <ext:Panel 
        runat="server" 
        Flex="1" 
        Title="Panel1"
        BodyStyle="background-color: green;">
        <Bin>
            <ext:Window ID="Window1" runat="server" Title="Window" />
        </Bin>
        <HtmlBin>
            <ext:XScript runat="server">
                <script type="text/javascript">
                     var show = function () { 
                        #{Window1}.show();
                     };
                </script>
            </ext:XScript>
        </HtmlBin>
        <Items>
            <ext:Button runat="server" Text="Show Window">
                <Listeners>
                    <Click Fn="show" />
                </Listeners>
            </ext:Button>
        </Items>
    </ext:Panel>
    
    <ext:Panel 
        runat="server" 
        Flex="1" 
        Title="Panel 2"
        BodyStyle="background-color: yellow;" />
    Last edited by Daniil; Aug 16, 2012 at 11:53 AM.
  7. #7
    So the recommended strategy is to use Bin and HtmlBin to deal with controls not participating in parent layout. I realize Bin has been around even in 1.0 versions, but I don't believe that section has been that clear as to its purpose. I haven't been using it. Examples have been weak in demonstrating this "newer" concept that kind of evolved along the path of development from 1.0 beta. With extjs 4.0, one of the design goals has been to reduce complexity and provide a design model. You guys need more design models like the example above to show suggested design principles for user controls and layouts. I realize a lot of work has gone into making it work but I find the examples explorer weak in drawing this functionality out into the open and will make for a high learning curve unless you really spell out what Bin is for.

    In anycase, I haven't had any problems in 1.4 using ext:Xscripts and ext:Windows anywhere in the user control. I wrap the sections participating in parent layout with <ext:*Layout > controls. It works. I can't tell you why. I've gone back to 1.4 to launch my project. I couldn't justify another loss in time due to learning curve through another beta development phase.
    Last edited by michaeld; Jul 14, 2012 at 3:54 AM.
  8. #8
    Agree, any online example of usage Bin and HtmlBin would be good. Thanks for the suggestion.

    Quote Originally Posted by michaeld@vipmail.com View Post
    In anycase, I haven't had any problems in 1.4 using ext:Xscripts and ext:Windows anywhere in the user control. I wrap the sections participating in parent layout with <ext:*Layout > controls. It works. I can't tell you why. I've gone back to 1.4 to launch my project. I couldn't justify another loss in time due to learning curve through another beta development phase.
    Well, repeat myself:
    Quote Originally Posted by Daniil View Post
    Well, it is impossible to implement the same in v1.4 as well. In v1.4 the VBoxLayout setting will be just ignored and the user control items won't participate in the layout logic.
    So, the Layout of a container where you put such user control is just ignored in Ext.NET v1. In Ext.NET v2 it throws the exception.
  9. #9
    We added the two Bin, HtmlBin examples in SVN (the 2.1 branch).

    Also they will be publicly available with the next 2.1 release via these links.
    https://examples2.ext.net//#/Miscell...lBin/Overview/
    https://examples2.ext.net//#/Miscell...n/UserControl/
  10. #10

    Thanks

    Quote Originally Posted by Daniil View Post
    We added the two Bin, HtmlBin examples in SVN (the 2.1 branch).

    Also they will be publicly available with the next 2.1 release via these links.
    https://examples2.ext.net//#/Miscell...lBin/Overview/
    https://examples2.ext.net//#/Miscell...n/UserControl/
    The new examples are helpful. I've been forced since IE10 to upgrade to 2.1 since IE10 does not seem to support it well in the old ext.net 1.X branch. I've got over 10,000 lines of code to remodel.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 7
    Last Post: Jan 29, 2013, 11:59 AM
  2. Replies: 8
    Last Post: Jul 20, 2012, 1:33 PM
  3. [CLOSED] XScript as server control
    By betamax in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 11, 2012, 1:05 PM
  4. Replies: 2
    Last Post: Jun 06, 2012, 3:38 PM
  5. [CLOSED] Panel layout type seems to break when using ContentFromPage
    By machinableed in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 26, 2012, 7:20 AM

Posting Permissions