[CLOSED] UserControl inside Ext:Panel

  1. #1

    [CLOSED] UserControl inside Ext:Panel

    Hi : UserControlLoader - will not render the .ascx file - inside Ext:Panel - either using CodeBehind or plain Markup
    Most likely we are doing something wrong. Please advise...

    <ext:Panel ID="panelExtNet" runat="server" Visible="false"
                    Layout="Fit" Region="Center" 
                                    AnchorHorizontal="true" AnchorVertical="true"  >
                    <Loader ID="loaderPanelExtNet"
                        runat="server" 
                        Mode="Component">
                        <LoadMask ShowMask="true" />
                    </Loader>
                                    <Items>
                                    <ext:UserControlLoader
                                        ID="SomeID"
                                        runat="server"
                                        UserControlID="SomeID"
                                        Path="ucAssignments.ascx" />
                                    </Items>
                </ext:Panel>
    
    --------------------------
        case libVACommon.ModuleID_pro_Teachers_Assignments:
                                            _VAExtCommon.debugMsg("ExtHost:CaseVWG->Ext:sModuleID=", sModuleID, true, false, true);
                                            //this.panelExtNet.Controls.Clear();
                                            this.panelVWG.ClearContent();
                                            this.panelVWG.Controls.Clear();
                                            this.panelVWG.Hidden = true;
                                            this.panelExtNet.ClearContent();
                                            UserControlLoader ucl = new UserControlLoader();
                                            ucl.Path = "ucAssignments.ascx";
                                            //viewportVA.Controls.Add(ucl);
                                            this.panelExtNet.Items.Add(ucl);
                                            this.panelExtNet.ToFrontOnShow = true;
                                            this.panelExtNet.Hidden = false;
                                            this.panelExtNet.Render();
                                            this.panelExtNet.Show();
                                            break;
    -------------------------------------
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucAssignments.ascx.cs" Inherits="VA.ucAssignments1" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <ext:Panel ID="Panel1" runat="server" Html="Hello from User Control. I am 1" />
    
    TEST : Ext.Net : Web User Control (Asp.Net User Control .ascx)
    
    <ext:CalendarCombo ID="CalendarCombo1" runat="server">
    </ext:CalendarCombo>
    Last edited by Daniil; Sep 03, 2013 at 4:59 AM. Reason: [CLOSED]
  2. #2
    Hi @VirtualArtists,

    You should not use a Panel's Loader and Items at the same time. The single option is good enough to load a user control.

    Here is an example of loading a user control via Loader.
    https://examples2.ext.net/#/Loaders/...Direct_Method/

    Here is an example of loading a user control via UserControlLoader.

    Page
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Panel runat="server">
                <Items>
                    <ext:UserControlLoader runat="server" Path="TestUC.ascx" />
                </Items>
            </ext:Panel>
        </form>
    </body>
    </html>
    User Control
    <%@ Control Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" TagPrefix="ext" Namespace="Ext.Net" %>
    
    <ext:Label runat="server" Text="Hello for User Control!" />
  3. #3
    Hi - Thanks, now the UserControl is diaplying. One new issue :

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucAssignmentsSummary.ascx.cs" Inherits="VA.ucAssignmentsSummary" %>
    
    <%@ Register Assembly="Ext.Net" TagPrefix="ext" Namespace="Ext.Net" %>
    
    <ext:Container runat="server" Layout="VBoxLayout" >
    <Items>
    	<ext:Label ID="Label1" runat="server" Text="Hello for User Control!" />
    
    	<ext:Button ID="Button1" runat="server" Text="Submit">
    	</ext:Button>
    
    </Items>
    </ext:Container>
    This code above works fine, BUT if I drop an ext:CalendarCombo onto the page directly from the toolbar, below that button, then the UserControl no longer displays. It seems like an error, but no error message:

    So adding this one ext:CalendarCombo object - in code below - directly after the button in above code, breaks this page?
    	<ext:CalendarCombo ID="CalendarCombo1" runat="server" >
    	</ext:CalendarCombo>
    Please advise...
    Last edited by VirtualArtists; Aug 23, 2013 at 10:37 AM.
  4. #4
    The CalendarCombo control is used internally by the CalendarPanel class. I don't think it should be used publicly.

    What kind of control do you need?
  5. #5
    hi - Thanks for the info, we will try various controls. You advised not to use CalendarCombo by itself because it was used internally by the CalendarPanel class. We were not aware of that, only from looking at the toolbar.

    Question: Any way to tell which controls on the Ext.Net toolbar are not meant to be used by themselves?
  6. #6
    Well, you could use CalendarCombo but it requires CalendarStore (you have to define CalendarStore in the page and set CalendarStoreID for CalendarCombo)

Similar Threads

  1. [CLOSED] Looking for way to use DirectMethods inside UserControl
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 19, 2012, 11:00 AM
  2. Replies: 4
    Last Post: Dec 19, 2012, 9:58 AM
  3. Replies: 0
    Last Post: Nov 28, 2012, 8:08 AM
  4. Replies: 8
    Last Post: Feb 15, 2012, 9:04 AM
  5. Help with UserControl inside window
    By dbassett74 in forum 1.x Help
    Replies: 0
    Last Post: May 26, 2009, 4:25 PM

Posting Permissions