View Full Version : Delay User Control from loading

May 18, 2012, 5:34 PM
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 (http://forums.ext.net/showthread.php?18270-Unable-to-use-User-Control-inside-Portlet-control-This-type-of-page-is-not-served)

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">
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>


<%@ 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

<asp:Content ContentPlaceHolderId="CenterContent" runat="server">
<script type="text\javascript">
... Javascript routines

<ext:TapPanel runat="server" Region="Center">
<ext:Panel runat="server" Title="Roles" Icon="Group" Layout="FitLayout">
<AfterRender Handler="{DirectMethods}.LoadTabRoles(this.id);" />

May 21, 2012, 1:54 PM

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.