Delay User Control from loading

  1. #1

    Delay User Control from loading

    I found the recent thread and tried to use the suggestion to delay my user controls from rendering until the tab is selected:

    Delay User Control

    I have added the listener and direct method, but I get an error "Cannot call method LoadTabRoles of undefined" when I select the tab. My aspx page uses a master page and has a content place holder for the head and body. Where should I place the <script runat="server"> [DirectMethod] section.

    <script runat="server">
         [DirectMethod]
         public static void LoadUserControl(string containerId)
         {
             X.Js.AddScript(UserControlRenderer.ToScript(new UserControlRendrerConfig
             {
                 UserControlPath = "~/Section-User/TabRoles.ascx",
                 Mode = RenderMode.AddTo,
                 SingleControl = true,
                 Element = containerId
             }));
         } </script>
    UserRole.aspx
    <%@ Page ... MasterPageFile="~/WAM.Master" ... %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %> 
    
    <asp:Content ContentPlaceHolderId="HeadContent" runat="server">
       <ext:XScript runat="server"
          <script type="text\javascript">
             ... Javascript routines
          </script>
       </ext:XScript>
    </asp:Content>
    
    <asp:Content ContentPlaceHolderId="CenterContent" runat="server">
       <script type="text\javascript">
          ... Javascript routines
       </script>
    
       <ext:TapPanel runat="server" Region="Center">
          <ext:Panel runat="server" Title="Roles" Icon="Group" Layout="FitLayout">
             <Listeners>
                <AfterRender Handler="{DirectMethods}.LoadTabRoles(this.id);" />
             </Listeners>
          </ext:Panel>
       </ext:TabPanel>
    </asp:Content>
  2. #2
    Hi,

    Posting the questions on non Premium forums causes a possibility your questions to be not answered or answered with a big delay. I've just discovered your question.

    Please see the example how to refer a DirectMethod from a master page.
    https://examples2.ext.net/#/Events/D...thods/ID_Mode/

Similar Threads

  1. [CLOSED] Example of loading user control with data binding
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Aug 18, 2012, 7:01 AM
  2. Replies: 0
    Last Post: May 16, 2012, 11:29 PM
  3. Dynamic User Control Loading
    By Rupesh in forum 1.x Help
    Replies: 0
    Last Post: Apr 08, 2011, 7:48 AM
  4. Replies: 8
    Last Post: Jan 25, 2011, 4:21 AM
  5. Dynamically loading a user control
    By kene in forum 1.x Help
    Replies: 0
    Last Post: Mar 16, 2009, 7:28 AM

Posting Permissions