[CLOSED] reference of a control loaded by component loader

  1. #1

    [CLOSED] reference of a control loaded by component loader

    Hi

    I am using a component loader which loads a user control throough a webservice. I need to somehow get a reference of this user control to further process things, is this possible if not is this a better way to do it: https://examples2.ext.net/#/XRender/...UpdateContent/

    Here is an example of Component loader I am using it is similer to https://examples2.ext.net/#/Loaders/...ON_WebService/
    <%@ Page Language="C#" %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <script runat="server">
       protected void Panel1_Activated(object sender, DirectEventArgs args)
        {
           
           //how to get a reference to the user control that the loader in Panel1 loads? is it possible?
            //var c = Panel1.ContentControls;
           //Panel1.FindControl()
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Loader - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    </head>
    <body>
        <h1>Component Loader (JSON WebService)</h1>
        
        <ext:ResourceManager runat="server" />    
       
        <ext:Panel
        ID="Panel1"
            runat="server"         
            Height="200" 
            Width="500"
            Layout="FitLayout"
            Title="Load user control from JSON WebService (manual loading)">
            <Loader 
                runat="server" 
                AutoLoad="false"
                Url="ComponentService.asmx/UserControl" 
                Mode="Component">
                <AjaxOptions Json="true" />
                <LoadMask ShowMask="true" />
            </Loader>
            <Buttons>
                <ext:Button runat="server" Text="Load" Icon="PluginGo">
                    <Listeners>
                        <Click Handler="this.up('panel').load();this.disable(); #{Panel1}.enable();" />
                    </Listeners>
                </ext:Button>
            </Buttons>
    
            <DirectEvents>
                <Enable OnEvent="Panel1_Activated"></Enable>
            </DirectEvents>
        </ext:Panel>
    </body>
    </html>
    Last edited by Daniil; Dec 28, 2012 at 2:11 PM. Reason: [CLOSED]
  2. #2
    Hello!

    There is only one way to get UserControl is to load it again as done in this example https://examples2.ext.net/#/XRender/...UpdateContent/ .

    However, if you'll provide more information about how do you want to use it we can help you.
  3. #3
    Quote Originally Posted by Baidaly View Post
    However, if you'll provide more information about how do you want to use it we can help you.
    well in this method I want to get a reference to the Items.asmx user control loaded by the webservice from this path "~/Examples/Loaders/_Shared/Items.ascx", like Panel1.ContentControls[0] would be my first guess but it is empty.
    <script runat="server">
       protected void Panel1_Activated(object sender, DirectEventArgs args)
        {
            
           //how to get a reference to the user control that the loader in Panel1 loads? is it possible?
            //var c = Panel1.ContentControls;
           //Panel1.FindControl()
        }
    </script>
    I'd like to implement it with this component loader as it is an elegant way in my case, where I have many user controls which should be loaded in a panel each time user selects it. But if this is not possible I can see to do it as in Xrender example.
    Thanks
  4. #4
    Hi @mirwais,

    There is no way to access a user control created in a WebService.

    A user control created in a WebService is "serialized" to respective JavaScript code and sent to a client (browser). The user control instance is not saved anywhere.

    Could you clarify why do you need to access that user control and its controls in page's code behind?
  5. #5

    closed

    Quote Originally Posted by Daniil View Post
    Hi @mirwais,

    There is no way to access a user control created in a WebService.

    A user control created in a WebService is "serialized" to respective JavaScript code and sent to a client (browser). The user control instance is not saved anywhere.

    Could you clarify why do you need to access that user control and its controls in page's code behind?
    Thanks for the clarification, you can close this thread. I wanted to use the control in a DirectEvent but I liked to use the component loader as this was a cleaner way to do it especially when you have more than one user control and don't want to load them automatically but based on user'w request. Now I am using a Container with a cardlayout having both user controls and I set the activeitem each time user selects a control to see. In this case ofcourse I don't have problems with getting the reference to the user control. Anyways this thread helped me at least know better the component loader and the way the web service generates the user control, thank you guys.

Similar Threads

  1. [CLOSED] Component Loader
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 13
    Last Post: Nov 13, 2012, 3:08 PM
  2. Replies: 8
    Last Post: Aug 13, 2012, 11:47 PM
  3. [CLOSED] Access Child items within loader Component
    By Digital.Dynamics in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 12, 2012, 4:09 PM
  4. Loader and Frame
    By Birgit in forum 2.x Help
    Replies: 0
    Last Post: Apr 17, 2012, 12:17 PM
  5. Ext.net 2x Exmaples Loader
    By NickBin in forum 2.x Help
    Replies: 7
    Last Post: Mar 21, 2012, 10:56 AM

Posting Permissions