How to load dynamic user controls on desktop shortcut?

  1. #1

    How to load dynamic user controls on desktop shortcut?

    There are a lot of user controls (.ascx) in my App so including all of them to desktop as mentioned is too low.
    I have Desktop.aspx:
    <%@ Register Src="modules/UserWin.ascx" TagPrefix="mod" TagName="UserWin" %>
    <mod:UserWin runat="server" id="UserWinCtrl"/>

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="UserWin.ascx.cs" Inherits="modules_UserWin" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <ext:DesktopModuleProxy ID="DesktopModuleProxy1" runat="server">
    <Module ModuleID="grid-win">
    <Shortcut Name="Users" IconCls="x-im-shortcut" SortIndex="1">
    <Launcher Text="Users" Icon="User" />
    <ext:Window runat="server" ID="userWin" Icon="User" Width="740" Height="480" AnimCollapse="false"
    ConstrainHeader="true" Layout="BorderLayout" Title="Manage User">
    <BeforeShow OnEvent="OnLoad" />
    <ext:Toolbar ID="toolbarUserWin" runat="server">
    <ext:TriggerField ID="txtUserSearch" runat="server" Width="200">
    <ext:FieldTrigger Icon="Clear" Qtip="" />
    <ext:FieldTrigger Icon="Search" />
    <TriggerClick Handler="BCCVDA.UserWin.BindData(index);" />
    <%-- <TriggerClick Handler="Ext.Msg.alert('Message', 'TriggerIndex: ' + index + '<br /><br />Text: ' + this.getValue());" />--%>
    <%-- <DirectEvents>
    <TriggerClick OnEvent="BindData"></TriggerClick>

    <ext:ToolbarSeparator ID="ToolbarSeparator3" runat="server" />
    <ext:Button ID="btnAdd" runat="server" Text="Add" Icon="Add" ToolTip="Add a new user">
    <ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server" />
    <ext:Button ID="Button2" runat="server" Text="Options" Icon="Plugin">
    <ext:ToolbarSeparator ID="ToolbarSeparator2" runat="server" />
    <ext:Button ID="Button3" runat="server" Text="Remove Something" ToolTip="Remove the selected item"
    <QTipCfg Text="Remove the selected user" />
    <ext:GridPanel ID="gridUser" runat="server" Title="User List" Width="700" Height="310"
    <ext:Store ID="Store1" runat="server" OnReadData="OnReadData" PageSize="10" RemoteSort="true">
    <ext:Parameter Name="start" Value="0" Mode="Raw" />
    <ext:Parameter Name="limit" Value="10" Mode="Raw" />
    <ext:PageProxy />
    <ext:Model ID="Model1" runat="server" IDProperty="UserId">
    <ext:ModelField Name="FullName" />
    <ext:ModelField Name="UserName" />
    <ext:ModelField Name="UserId" Type="Int" />
    <ext:ModelField Name="Email" />
    <ColumnModel ID="ColumnModel1" runat="server">
    <ext:Column ID="Column1" runat="server" Text="Full Name" DataIndex="FullName" Width="250" />
    <ext:Column ID="Column2" runat="server" Text="User Name" DataIndex="UserName" />
    <ext:Column ID="Column3" runat="server" Text="User Id" DataIndex="UserId" />
    <ext:Column ID="Column4" runat="server" Text="Email" DataIndex="Email" Width="200" />
    <%-- <ext:Column ID="Column2" runat="server" Text="Price" Width="75" DataIndex="price">
    <Renderer Format="UsMoney" />
    <ext:Column ID="Column3" runat="server" Text="Change" Width="75" DataIndex="change">
    <Renderer Fn="change" />
    <ext:Column ID="Column4" runat="server" Text="Change" Width="75" DataIndex="pctChange">
    <Renderer Fn="pctChange" />
    <ext:DateColumn ID="DateColumn1" runat="server" Text="Last Updated" Width="85" DataIndex="lastChange"
    Format="H:mm:ss" />--%>
    <ext:GridFilters ID="GridFilters1" runat="server">
    <ext:StringFilter DataIndex="FullName" />
    <ext:StringFilter DataIndex="UserName" />
    <ext:NumericFilter DataIndex="UserId" />
    <ext:StringFilter DataIndex="Email" />
    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Single">
    <Select OnEvent="RowSelect">
    <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{formUser}" />
    <%--or can use params[2].id as value--%>
    <ext:Parameter Name="UserId" Value="record.getId()" Mode="Raw" />
    <ext:GridView ID="GridView1" runat="server" StripeRows="true">
    <ext:PagingToolbar ID="PagingToolbar1" runat="server">
    <ext:Label ID="Label1" runat="server" Text="Page size:" />
    <ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
    <ext:ComboBox ID="cboPageSize" runat="server" Width="80">
    <ext:ListItem Text="10" />
    <ext:ListItem Text="20" />
    <ext:ListItem Text="50" />
    <ext:ListItem Text="100" />
    <ext:ListItem Text="200" />
    <ext:ListItem Text="500" />
    <ext:ListItem Value="10" />
    <Select Handler="#{gridUser}.store.pageSize = parseInt(this.getValue(), 10); #{gridUser}.store.load();" />
    <ext:ProgressBarPager ID="ProgressBarPager1" runat="server" />
    <ext:FormPanel ID="formUser" runat="server" Region="East" Split="true" Layout="columnLayout"
    Title="User Details" Width="600" Icon="User" Collapsible="true" DefaultAnchor="100%">
    <ext:TabPanel ID="TabPanel1" runat="server" ColumnWidth="1" Border="false" ActiveTabIndex="0"
    <ext:Panel ID="Panel1" runat="server" Title="General Info" Border="false" ActiveIndex="0"
    ColumnWidth="1" Layout="ColumnLayout" DefaultBorder="false" DefaultPadding="0">
    <ext:Panel ID="Panel2" runat="server" Border="false" Header="false" ColumnWidth="0.5"
    Layout="Form" LabelAlign="Top">
    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
    <ext:Parameter Name="MsgTarget" Value="side" />
    <ext:TextField ID="txtUserId" runat="server" FieldLabel="User Id" ReadOnly="true" />
    <ext:TextField ID="txtFirstName" runat="server" FieldLabel="First Name" />
    <ext:TextField ID="txtFullName" runat="server" FieldLabel="Full Name" />
    <ext:TextField ID="txtEmail" runat="server" FieldLabel="Email" />
    <ext:TextField ID="txtWorkPhone" runat="server" FieldLabel="WorkPhone" />
    <ext:TextField ID="txtHomePhone" runat="server" FieldLabel="HomePhone" />
    <ext:Panel ID="Panel3" runat="server" Border="false" Layout="Form" ColumnWidth="0.5"
    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
    <ext:Parameter Name="MsgTarget" Value="side" />
    <ext:TextField ID="txtUserName" runat="server" FieldLabel="User Name" />
    <ext:TextField ID="txtLastName" runat="server" FieldLabel="Last Name" />
    <ext:TextField ID="txtAddress" runat="server" FieldLabel="Address" />
    <ext:Panel ID="Panel4" runat="server" Title="Description" Border="false" ColumnWidth="1"
    Layout="ColumnLayout" DefaultBorder="false" DefaultPadding="0">
    <ext:Panel ID="Panel5" runat="server" Border="false" Header="false" ColumnWidth="0.5"
    Layout="Form" LabelAlign="Top">
    <ext:Parameter Name="AllowBlank" Value="false" Mode="Raw" />
    <ext:Parameter Name="MsgTarget" Value="side" />
    <ext:TextField ID="TextFieldww1" runat="server" FieldLabel="First Name" />
    <ext:TextField ID="TextFieldww2" runat="server" FieldLabel="Company" />
    <ext:Button ID="Button4" runat="server" Text="Save" Icon="Disk">
    <Click Handler="if (#{formUser}.getForm().isValid()) {Ext.Msg.alert('Submit', 'Saved!');}else{{icon: Ext.MessageBox.ERROR, msg: 'FormPanel is incorrect', buttons:Ext.Msg.OK});}" />


    When launch Desktop.aspx then UserWin.ascx will be loaded, too. How can I prevent this? I just want to load UserWin.ascx in a window when clicking on shortcut.

  2. #2
    The sample is mentioned by you ( demosntrates dynamic loading from user control also
    Please review that sample again
  3. #3
    Thanks Vladimir,

    I reviewed it and try to replace existing sample (TabWindow.ascx) to mine (UserWin.ascx):
    public void AddNewModule()
    var control = Ext.Net.Utilities.ControlUtils.FindControl<Ext.Net .DesktopModuleProxy>(this.LoadControl("modules/UserWin.ascx"));


    Try to click Render Dynamic module, i had my UserWin shortcut. Click on it and receive 2 errors:
    1. The control with ID 'userWin' not found.
    2. The control with ID 'Store1' not found.
    Please UserWin.ascx in previous post to see its content. How to fix these errors?

    Moreover, instead clicking Render Dynamic module shortcut to render my module, I tried to render my shortcut at page load but it doesn't work:
    protected void Page_Load(object sender, EventArgs e)
    if (!X.IsAjaxRequest)
    // this.BindData();
    var control = Ext.Net.Utilities.ControlUtils.FindControl<Ext.Net .DesktopModuleProxy>(this.LoadControl("modules/UserWin.ascx"));


    Please give me your idea.

  4. #4
    I have the same error and the same question. Could someone answer, please ?
  5. #5
    can any help us ?

Similar Threads

  1. Replies: 1
    Last Post: Jul 20, 2012, 8:08 AM
  2. Replies: 5
    Last Post: Jan 19, 2011, 3:17 PM
  3. [CLOSED] Dynamic load user controls in Opera
    By Timur.Akhmerov in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: May 06, 2010, 2:49 AM
  4. [CLOSED] Dynamic loading of user controls [1.0]
    By SFritsche in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Feb 11, 2010, 6:08 AM
  5. How to dynamically load user controls?
    By zikr in forum 1.x Help
    Replies: 0
    Last Post: Jan 23, 2009, 9:35 PM

Posting Permissions