dynamic load usercontrol in ext:pannel.

  1. #1

    dynamic load usercontrol in ext:pannel.

    Hi everyone,

    I Have a 4 user controls in the page. I display it one by on in group tab and after save button the other group tab is open in which the user control is load. Now i Want that how can i load the user control dynamically.
    I writs as following code.
    GroupTab grpTab = new GroupTab();
                    grpTab = (GroupTab)this.Parent.FindControl("GroupMedicalHistory").FindControl("grpPastMedicalHistory");
                    grpTab.SetActiveTab(0);
                    Ext.Net.Panel pl = new Ext.Net.Panel();
                    pl = (Ext.Net.Panel)this.Parent.FindControl("GroupMedicalHistory").FindControl("grpPastMedicalHistory").FindControl("pnlPastMedicalHistory");
                    pl.LoadContent("~/UserControl/PastMedicalHistoryControl.ascx");
    Please help me out...
  2. #2
    Hi,

    Maybe this example can help you, see

    https://examples1.ext.net/#/XRender/...UpdateContent/
    Geoffrey McGill
    Founder
  3. #3
    The example was good but i want to add the asp user control and i adding user control from the asp user control.
    please help me out
    the code is
    GroupTab grpTab = new GroupTab();
                    grpTab = (GroupTab)this.Parent.FindControl("GroupMedicalHistory").FindControl("grpPastMedicalHistory");
                    
                    Ext.Net.Panel pl = new Ext.Net.Panel();
                    pl =(Ext.Net.Panel)this.Parent.FindControl("GroupMedicalHistory").FindControl("grpPastMedicalHistory").FindControl("pnlPastMedicalHistory");
                    //X.Js.Call("destroyFromCache", new JRawValue(pl.ClientID));
                    UserControl uc1 = (UserControl)this.LoadControl("~/UserControl/PastMedicalHistoryControl.ascx");
                    uc1.ID = "UC1";
                    pl.ContentControls.Add(uc1);
    
                    //X.Js.Call("putToCache", new JRawValue(pl.ClientID), uc1.ControlsToDestroy);
                    pl.UpdateContent();
                    grpTab.SetActiveTab(0);
  4. #4
    Hi ,

    I want to load the dynamic user control more than 2. And want to add this control in the window which will be shows on the command button of the grid but it is not shows. plz help me out

    I write code like this

    This is window
    <ext:Window ID="win1" runat="server" Width="600" Height="540" Hidden="true">
            </ext:Window>
    This is the grid
    <ext:GridPanel ID="grdQuestion" runat="server" Title="Old Symptoms Details" Height="415"
          Frame="true" AutoWidth="true" AutoExpandColumn="Symptoms" AnchorHorizontal="100%">
                   <Columns>             
          <ColumnModel ID="columnmodel2" runat="server">
                 <Commands>
                       <ext:GridCommand Icon="ArrowDown" Text="Worse" CommandName="Worse">
                              <ToolTip Text="Click To Edit" />
                       </ext:GridCommand>
                </Commands>
    </Columns>
    </ColumnModel>
          <Listeners>
           <Command Handler="Ext.net.DirectMethods.DisplayJawClicking(record.data.Symptoms,command);" />
           </Listeners>                                                                   
    </ext:GridPanel>

    And in the cs file i write
    if (X.IsAjaxRequest)
                {
                    BaseUserControl uc3 = (BaseUserControl)this.LoadControl("~/UserControl/u1.ascx");
                    uc3.ID = "u1";
                    this.win1.ContentControls.Add(uc3);
    
                    BaseUserControl uc4 = (BaseUserControl)this.LoadControl("~/UserControl/u2.ascx");
                    uc4.ID = "u2";
                    this.win1.ContentControls.Add(uc4);
                }
    And i write the code in the direct method like
    this.win1.ContentControls.Add(uc4);
            RowSelectionModel sm = this.grdQuestion.SelectionModel.Primary as RowSelectionModel;
            X.Js.Call("destroyFromCache", new JRawValue(winJawClicking.ClientID));
            BaseUserControl uc = new BaseUserControl();
            if (sSymptoms == "con1")
            {
                BaseUserControl UC3 = (BaseUserControl)this.FindControl("u1");
                X.Js.Call("putToCache", new JRawValue(win1ClientID), uc3.ControlsToDestroy);
                uc = UC3;
               
            }
            if (sSymptoms == "con2")
            {
                BaseUserControl UC4 = (BaseUserControl)this.FindControl("u2");
                X.Js.Call("putToCache", new JRawValue(win1.ClientID), uc4.ControlsToDestroy);
                uc = UC4;
            }
    
            win1.Modal = true;
            win1.Show();
            this.win1.ContentControls.Add(uc);
            this.win1.UpdateContent();
    Thanks in advance
    Last edited by PrasadJoshi; Jan 14, 2011 at 6:31 AM. Reason: Adding Code
  5. #5
    Anyone knows this problem soluction....................
  6. #6
    hi guys ,

    Any progress Plz give me replay...

Similar Threads

  1. Load Usercontrol on DesktopModule
    By Kaveh in forum 2.x Help
    Replies: 6
    Last Post: Apr 28, 2012, 4:59 AM
  2. regarding usercontrol load in runtime
    By ranjit2k99 in forum 1.x Help
    Replies: 22
    Last Post: May 30, 2011, 1:38 PM
  3. [CLOSED] [1.0] Load dynamic UserControl with Coolite Controls.
    By FVNoel in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 22, 2010, 10:27 AM
  4. load usercontrol in viewport
    By maxdiable in forum 1.x Help
    Replies: 1
    Last Post: Jul 28, 2010, 11:01 PM
  5. Load usercontrol by AjaxEvents
    By latif in forum 1.x Help
    Replies: 4
    Last Post: Dec 15, 2009, 3:22 PM

Posting Permissions