May 18, 2012, 5:34 PM
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.
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>