[CLOSED] viewport load problem in Usercontrol

  1. #1

    [CLOSED] viewport load problem in Usercontrol

    i have add a viewport to window control in usercontrol of asp.net and call this control in Desktop Page it show like image attached.


    i want to load gridpanel in the viewport code attached bellow thanks


    Meer Hassan


    Click image for larger version. 

Name:	Desktop_Viewport_addcontol.jpg 
Views:	11 
Size:	61.8 KB 
ID:	7393


    <%@ Control Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        private object[] TestData
        {
            get
            {
                return new object[]
                {
                    new object[] { "3m Co", 71.72, 0.02, 0.03 },
                    new object[] { "Alcoa Inc", 29.01, 0.42, 1.47 },
                    new object[] { "Altria Group Inc", 83.81, 0.28, 0.34 },
                    new object[] { "American Express Company", 52.55, 0.01, 0.02 },
                    new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49 },
                    new object[] { "AT&T Inc.", 31.61, -0.48, -1.54 },
                    new object[] { "Boeing Co.", 75.43, 0.53, 0.71 },
                    new object[] { "Caterpillar Inc.", 67.27, 0.92, 1.39 },
                    new object[] { "Citigroup, Inc.", 49.37, 0.02, 0.04 },
                    new object[] { "E.I. du Pont de Nemours and Company", 40.48, 0.51, 1.28 },
                    new object[] { "Exxon Mobil Corp", 68.1, -0.43, -0.64 },
                    new object[] { "General Electric Company", 34.14, -0.08, -0.23 },
                    new object[] { "General Motors Corporation", 30.27, 1.09, 3.74 },
                    new object[] { "Hewlett-Packard Co.", 36.53, -0.03, -0.08 },
                    new object[] { "Honeywell Intl Inc", 38.77, 0.05, 0.13 },
                    new object[] { "Intel Corporation", 19.88, 0.31, 1.58 },
                    new object[] { "International Business Machines", 81.41, 0.44, 0.54 },
                    new object[] { "Johnson & Johnson", 64.72, 0.06, 0.09 },
                    new object[] { "JP Morgan & Chase & Co", 45.73, 0.07, 0.15 },
                    new object[] { "McDonald\"s Corporation", 36.76, 0.86, 2.40 },
                    new object[] { "Merck & Co., Inc.", 40.96, 0.41, 1.01 },
                    new object[] { "Microsoft Corporation", 25.84, 0.14, 0.54 },
                    new object[] { "Pfizer Inc", 27.96, 0.4, 1.45 },
                    new object[] { "The Coca-Cola Company", 45.07, 0.26, 0.58 },
                    new object[] { "The Home Depot, Inc.", 34.64, 0.35, 1.02 },
                    new object[] { "The Procter & Gamble Company", 61.91, 0.01, 0.02 },
                    new object[] { "United Technologies Corporation", 63.26, 0.55, 0.88 },
                    new object[] { "Verizon Communications", 35.57, 0.39, 1.11 },
                    new object[] { "Wal-Mart Stores, Inc.", 45.45, 0.73, 1.63 }
                };
            }
        }
    </script>
    
    <ext:DesktopModuleProxy runat="server">
        <Module ModuleID="grid-win">
            <Shortcut Name="Grid Window" IconCls="x-grid-shortcut" SortIndex="1" />
            <Launcher Text="Grid Window" Icon="Table" />
            <Window>
                <ext:Window runat="server"
                    Icon="Table" 
                    Width="740" 
                    Height="480"                
                    Layout="Fit"
                    Title="Grid Window">
                    <TopBar>
                        <ext:Toolbar runat="server">
                            <Items>
                                <ext:Button runat="server" Text="Add Something" Icon="Add" ToolTip="Add a new row">
                                </ext:Button>
    
                                <ext:ToolbarSeparator runat="server" />
    
                                <ext:Button runat="server" Text="Options" Icon="Plugin">
                                </ext:Button>
    
                                <ext:ToolbarSeparator runat="server" />
    
                                <ext:Button runat="server" Text="Remove Something" ToolTip="Remove the selected item" Icon="Decline">
                                    <QTipCfg Text="Remove the selected user" />
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </TopBar>
    
                    <Items>
           <ext:Viewport ID="Viewport1" runat="server" Layout="BorderLayout">
            <Items>
                <ext:Panel ID="Panel1" 
                    runat="server"
                    Title="North" 
                    Region="North"
                    Split="true"
                    Height="150"
                    BodyPadding="6"
                    Html="North"
                    Collapsible="true"
                    >
                    <Items>
                      <ext:GridPanel ID="GridPanel1" runat="server"
                            Border="false">
                            <Store>
                                <ext:Store ID="Store1" runat="server" Data="<%# TestData %>" AutoDataBind="true">
                                    <Model>
                                        <ext:Model ID="Model1" runat="server">
                                            <Fields>
                                                <ext:ModelField Name="Company" />
                                                <ext:ModelField Name="Price" Type="Float" />
                                                <ext:ModelField Name="Change" Type="Float" />
                                                <ext:ModelField Name="PctChange" Type="Float" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                    <Reader>
                                        <ext:ArrayReader />
                                    </Reader>
                                </ext:Store>
                            </Store>
    
                            <ColumnModel>
                                <Columns>
                                    <ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" />
                                    <ext:Column ID="Column1" runat="server" Text="Company" Flex="1" Sortable="true" DataIndex="Company" />
                                    <ext:Column ID="Column2" runat="server" Text="Price" Width="70" Sortable="true" DataIndex="Price">
                                        <Renderer Format="UsMoney" />
                                    </ext:Column>
                                    <ext:Column ID="Column3" runat="server" Text="Change" Width="70" Sortable="true" DataIndex="Change" />
                                    <ext:Column ID="Column4" runat="server" Text="% Change" Width="70" Sortable="true" DataIndex="PctChange" />
                                </Columns>
                            </ColumnModel>
                        </ext:GridPanel>
                    
                    </Items>
                    </ext:Panel>
                <ext:Panel ID="Panel2" 
                    runat="server" 
                    Title="West" 
                    Region="West"
                    Layout="AccordionLayout"
                    Width="225" 
                    MinWidth="225" 
                    MaxWidth="400" 
                    Split="true" 
                    Collapsible="true">
                    <Items>
                        <ext:Panel ID="Panel3" 
                            runat="server" 
                            Title="Navigation" 
                            Border="false" 
                            BodyPadding="6"
                            Icon="FolderGo"
                            Html="West"
                            />
                        <ext:Panel ID="Panel4" 
                            runat="server" 
                            Title="Settings" 
                            Border="false" 
                            BodyPadding="6"
                            Icon="FolderWrench"
                            Html="Some settings in here"
                            />
                    </Items>
                </ext:Panel>
                <ext:TabPanel ID="TabPanel1" runat="server" Region="Center">
                    <Items>
                        <ext:Panel ID="Panel5" 
                            runat="server" 
                            Title="Center" 
                            Border="false" 
                            BodyPadding="6"
                            Html="<h1>Viewport with BorderLayout</h1>"
                            />
                        <ext:Panel ID="Panel6" 
                            runat="server" 
                            Title="Close Me" 
                            Closable="true" 
                            Border="false" 
                            BodyPadding="6"
                            Html="Closeable Tab"
                            />
                    </Items>
                </ext:TabPanel>
                <ext:Panel ID="Panel7" 
                    runat="server" 
                    Title="East" 
                    Region="East"
                    Collapsible="true" 
                    Split="true" 
                    MinWidth="225"
                    Width="225" 
                    Layout="Fit">
                    <Items>
                        <ext:TabPanel ID="TabPanel2" 
                            runat="server"
                            ActiveTabIndex="1" 
                            TabPosition="Bottom" 
                            Border="false">
                            <Items>
                                <ext:Panel ID="Panel8" 
                                    runat="server" 
                                    Title="Tab 1" 
                                    Border="false" 
                                    BodyPadding="6"
                                    Html="East Tab 1"
                                    />
                                <ext:Panel ID="Panel9" 
                                    runat="server" 
                                    Title="Tab 2" 
                                    Closable="true" 
                                    Border="false" 
                                    BodyPadding="6"
                                    Html="East Tab 2"
                                    >
                                    <Items>
                                      <ext:GridPanel ID="GridPanel3" runat="server"
                            Border="false">
                            <Store>
                                <ext:Store ID="Store3" runat="server" Data="<%# TestData %>" AutoDataBind="true">
                                    <Model>
                                        <ext:Model ID="Model3" runat="server">
                                            <Fields>
                                                <ext:ModelField Name="Company" />
                                                <ext:ModelField Name="Price" Type="Float" />
                                                <ext:ModelField Name="Change" Type="Float" />
                                                <ext:ModelField Name="PctChange" Type="Float" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                    <Reader>
                                        <ext:ArrayReader />
                                    </Reader>
                                </ext:Store>
                            </Store>
    
                            <ColumnModel>
                                <Columns>
                                    <ext:RowNumbererColumn ID="RowNumbererColumn3" runat="server" />
                                    <ext:Column ID="Column9" runat="server" Text="Company" Flex="1" Sortable="true" DataIndex="Company" />
                                    <ext:Column ID="Column10" runat="server" Text="Price" Width="70" Sortable="true" DataIndex="Price">
                                        <Renderer Format="UsMoney" />
                                    </ext:Column>
                                    <ext:Column ID="Column11" runat="server" Text="Change" Width="70" Sortable="true" DataIndex="Change" />
                                    <ext:Column ID="Column12" runat="server" Text="% Change" Width="70" Sortable="true" DataIndex="PctChange" />
                                </Columns>
                            </ColumnModel>
                        </ext:GridPanel>
                                    
                                    </Items>
                                    </ext:Panel>
                            </Items>
                        </ext:TabPanel>
                    </Items>
                </ext:Panel>
                <ext:Panel ID="Panel10" 
                    runat="server"
                    Title="South"
                    Region="South"
                    Split="true"
                    Collapsible="true"
                    Height="150"
                    BodyPadding="6"
                    Html="South"
                    >
                    <Items>
                      <ext:GridPanel ID="GridPanel2" runat="server"
                            Border="false">
                            <Store>
                                <ext:Store ID="Store2" runat="server" Data="<%# TestData %>" AutoDataBind="true">
                                    <Model>
                                        <ext:Model ID="Model2" runat="server">
                                            <Fields>
                                                <ext:ModelField Name="Company" />
                                                <ext:ModelField Name="Price" Type="Float" />
                                                <ext:ModelField Name="Change" Type="Float" />
                                                <ext:ModelField Name="PctChange" Type="Float" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                    <Reader>
                                        <ext:ArrayReader />
                                    </Reader>
                                </ext:Store>
                            </Store>
    
                            <ColumnModel>
                                <Columns>
                                    <ext:RowNumbererColumn ID="RowNumbererColumn2" runat="server" />
                                    <ext:Column ID="Column5" runat="server" Text="Company" Flex="1" Sortable="true" DataIndex="Company" />
                                    <ext:Column ID="Column6" runat="server" Text="Price" Width="70" Sortable="true" DataIndex="Price">
                                        <Renderer Format="UsMoney" />
                                    </ext:Column>
                                    <ext:Column ID="Column7" runat="server" Text="Change" Width="70" Sortable="true" DataIndex="Change" />
                                    <ext:Column ID="Column8" runat="server" Text="% Change" Width="70" Sortable="true" DataIndex="PctChange" />
                                </Columns>
                            </ColumnModel>
                        </ext:GridPanel>
                    
                    </Items>
                    </ext:Panel>
            </Items>
        </ext:Viewport>
                    </Items>
                </ext:Window>
            </Window>
        </Module>
    </ext:DesktopModuleProxy>
    Last edited by Daniil; Dec 27, 2013 at 5:37 AM. Reason: [CLOSED]
  2. #2
    Hi @UT007,

    A Viewport must be the only one on the page and it must a top level container. So, it is wrong to put it inside a Window.

    Please use a Container instead of the Viewport.

    If you need the Window to fill all the available space, please try to set up Maximized="true" for that Window.

Similar Threads

  1. how to load viewport in Window?
    By richard in forum 2.x Help
    Replies: 2
    Last Post: Jan 27, 2014, 4:27 PM
  2. Replies: 4
    Last Post: Dec 19, 2012, 10:58 AM
  3. Load Usercontrol on DesktopModule
    By Kaveh in forum 2.x Help
    Replies: 6
    Last Post: Apr 28, 2012, 5:59 AM
  4. load usercontrol in viewport
    By maxdiable in forum 1.x Help
    Replies: 1
    Last Post: Jul 29, 2010, 12:01 AM
  5. Replies: 1
    Last Post: Jun 10, 2010, 12:28 PM

Tags for this Thread

Posting Permissions