Window and User Control

  1. #1

    Window and User Control

    Friends,
    I
    need your help, I have a user control with a window, this takes the
    information sent from a page, when I save the information, text field
    is blank, can you help?.
    Thank you.
    ASP Page
    <Buttons>
              </ext:Button>
                            <ext:Button ID="bEditJobTitle" runat="server" Text="Editar" Icon="NoteEdit">
                            <AjaxEvents>
                            <Click OnEvent="ShowParamWindow"></Click>
                           </AjaxEvents>
                            </ext:Button>
    </Buttons>
    <uc1:wucParamWindow ID="wucParamWindow1" runat="server" />
    ...
        public void ShowParamWindow(object sender, AjaxEventArgs e)
        {
        this.wucParamWindow1.Show(1,2,EParameterType.DEPARTAMENT,EActionType.INSERT);
        }
    
    public partial class wucParamWindow : System.Web.UI.UserControl
    {
       
        public void Show(int companyId, int fieldId, EParameterType parameterType, EActionType actionType)
        {
              this.winParam.Show();
              //Here, take the parameters are set correctly and to hdnParent
              this.hdnParent.Text = string.Format("{0};{1};{2};{3}", companyId, fieldId, Convert.ToInt32(parameterType), Convert.ToInt32(actionType));    
        }
    
        protected void bPrmSave_Click(object sender, EventArgs e)
        {
    
            string[] arrInfo = this.hdnParent.Text.Split(';'); //Here, in obtaining the information is blank
                ParameterBridge parameterBridge = new ParameterBridge();
                parameterBridge.InsertParameter(Convert.ToInt32(arrInfo[0]),
                                                Convert.ToInt32(arrInfo[1]),
                                                this.txtParamName.Text, // Here, in obtaining the information is blank
                                                (EParameterType)Convert.ToInt32(arrInfo[2]),
                                                (EActionType)Convert.ToInt32(arrInfo[3]));
        }
    }
    Thank you.

  2. #2

    RE: Window and User Control

    Hi gpcontreras,

    Your code sample does not include the <ext:TextField> component? Can you post a full (but simplified) sample demonstrating both the .aspx and .ascx markup.
    Last edited by geoffrey.mcgill; Mar 31, 2012 at 2:55 AM.
    Geoffrey McGill
    Founder
  3. #3

    RE: Window and User Control

    Here the complete code, thanks.


    BasicConfig.aspx
    ...
    <%@ Register src="~/UserControls/wucParamwindow.ascx" tagname="wucParamWindow" tagprefix="uc1" %>
    
    <asp:Content ID="ContentEBusiness" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <ext:TabPanel ID="tbpConfiguration" runat="server" ActiveTabIndex="0" 
            Frame="True" Height="700px">
            <tabs>
                <ext:Tab ID="tbDepartament" runat="server" Title="Departamentos" Frame="true" Icon="ApplicationViewTile">
                    <body>
                        <ext:Store ID="StoreDepartament" runat="server" AutoDataBind="true" AutoLoad="true" OnRefreshData="StoreDepartament_RefreshData">
                        </ext:Store>
                        <ext:GridPanel ID="GridDepartament" runat="server" ...>
                          <ColumnModel ID="ctl366" IDMode="Legacy">
                                 </ColumnModel>
                        <SelectionModel>
                                     <ext:RowSelectionModel ID="RowSelectionModelDepartament" runat="server" SingleSelect="true" />
                                </SelectionModel>
                                 <BottomBar>
                                <ext:PagingToolBar ID="ptbDepartament" runat="server" PageSize="20" />
                            </BottomBar> 
                        <Buttons>
                           <ext:Button ID="bAddDepartament" runat="server" Text="Agregar" Icon="Add">
                           <AjaxEvents>
                            <Click OnEvent="ShowParamWindow"></Click>
                           </AjaxEvents>
                           </ext:Button>
                           <ext:Button ID="bEditDepartament" runat="server" Text="Editar" Icon="NoteEdit">
                           <AjaxEvents>
                            <Click OnEvent="ShowParamWindow"></Click>
                           </AjaxEvents>
                           </ext:Button>
                           <ext:Button ID="bDeleteDepartament" runat="server" Text="Eliminar" Icon="Delete"></ext:Button>
                        
                        </Buttons>
                        </ext:GridPanel>
    
                    </body>
                    
    
                </ext:Tab>
        
                
            </tabs>
          
        </ext:TabPanel>
        <uc1:wucParamWindow ID="wucParamWindow1" runat="server" />
    </asp:Content>
    BasicConfig.aspx.cs
    using System;
    ...
    public partial class BasicConfig : System.Web.UI.Page
    {
    
            public void ShowParamWindow(object sender, AjaxEventArgs e)
        {
            
            Coolite.Ext.Web.Button bParent = (Coolite.Ext.Web.Button)sender;
           this.wucParamWindow1.Show(1,2,GCThunder.Library.Platform.Enumeration.EParameterType.DEPARTAMENT,GCThunder.Library.Platform.Enumeration.EActionType.INSERT);
    
        }
     
       
    }
    wucParamwindow.ascx


    
    <ext:Window ID="winParam" runat="server" Icon="Application" Title="Valor" 
        Closable="False" Height="150px" Width="350px" Modal="True" 
        AutoRender="False">
        <Body>
            <ext:FormPanel ID="fpParam" runat="server" BodyStyle="padding:5px;" ButtonAlign="Right"
                Frame="true" Height="100px" LabelWidth="50" Width="340px">
                <Body>
                    <ext:FormLayout ID="flParam" runat="server">
                        <ext:Anchor Horizontal="90%">
                            <ext:TextField ID="txtParamName" runat="server" FieldLabel="Valor">
                            </ext:TextField>
                        </ext:Anchor>
                        <ext:Anchor Horizontal="90%">
                              <ext:TextField  ID="hdnParent" runat="server" />
                        </ext:Anchor>
                    </ext:FormLayout>
                </Body>
            </ext:FormPanel>
          
        </Body>
            <Buttons>
                <ext:Button runat="server" ID="bPrmSave" Text="Grabar" Icon="Disk">
               <AjaxEvents >
              <Click OnEvent="bPrmSave_Click">
                <EventMask  ShowMask="true" Msg="Verifying..." MinDelay="500" />
              </Click>
             </AjaxEvents>
                </ext:Button>
       </Buttons>
    </ext:Window>
    wucParamwindow.ascx.cs
    using System;
    ....
    public partial class wucParamWindow : System.Web.UI.UserControl
    {
       
        public void Show(int companyId, int fieldId, EParameterType parameterType, EActionType actionType)
        {
              this.winParam.Show();
              this.hdnParent.Text = string.Format("{0};{1};{2};{3}", companyId, fieldId, Convert.ToInt32(parameterType), Convert.ToInt32(actionType));    
        }
    
        protected void bPrmSave_Click(object sender, EventArgs e)
        {
    
            string[] arrInfo = this.hdnParent.Text.Split(';');
                ParameterBridge parameterBridge = new ParameterBridge();
                parameterBridge.InsertParameter(Convert.ToInt32(arrInfo[0]),
                                                Convert.ToInt32(arrInfo[1]),
                                                this.txtParamName.Text,
                                                (EParameterType)Convert.ToInt32(arrInfo[2]),
                                                (EActionType)Convert.ToInt32(arrInfo[3]));
        }
    }
  4. #4

    Window and User Control

    I had the same problem. You need to add the UC into the contents of a panel in order for Ext UI controls to render. The confusing part is that Stores will render outside of the Panel but your windows wont.

    Watch uc1:FullTimesheet (has Stores and 3 windows), stores always load, but the windows on load when placed into the content of a panel not on the View itself.

    WORKS:
    </TopBar>                            <Content>
                                  <ext:Panel Visible="true" ID="Panel44444" Layout="Fit" runat="server"  Border="false" AllowDomMove="False" AnimCollapse="false" BodyBorder="false" CollapseFirst="False" Header="False" HeaderAsText="False" HideBorders="true" HideCollapseTool="True" HideLabel="True">
                                    <Items>
                                        <ext:RowLayout ID="RowLayout1" runat="server">
                                            <Rows>
                                                <ext:LayoutRow RowHeight="0.5">
                                                    <ext:Panel ID="FullTCPanelForWeek1" runat="server" Border="true" AllowDomMove="False" AnimCollapse="False" BodyBorder="false" CollapseFirst="False" Header="False" HeaderAsText="False" HideBorders="false" HideCollapseTool="True" HideLabel="True" HideParent="True">
                                                        <Content>
                                                            <uc1:FullTimesheet ID="FullTimesheet1" runat="server" />
                                                            <uc4:TC ID="TC1" runat="server"  WeekNumber="1" Visible="true"/>
    FAILS:
    </TopBar>                            <Content>
                                   <uc1:FullTimesheet ID="FullTimesheet1" runat="server" />
                                  
                                  <ext:Panel Visible="true" ID="Panel44444" Layout="Fit" runat="server"  Border="false" AllowDomMove="False" AnimCollapse="false" BodyBorder="false" CollapseFirst="False" Header="False" HeaderAsText="False" HideBorders="true" HideCollapseTool="True" HideLabel="True">
                                    <Items>
                                        <ext:RowLayout ID="RowLayout1" runat="server">
                                            <Rows>
                                                <ext:LayoutRow RowHeight="0.5">
                                                    <ext:Panel ID="FullTCPanelForWeek1" runat="server" Border="true" AllowDomMove="False" AnimCollapse="False" BodyBorder="false" CollapseFirst="False" Header="False" HeaderAsText="False" HideBorders="false" HideCollapseTool="True" HideLabel="True" HideParent="True">
                                                        <Content>
                                                            <uc4:TC ID="TC1" runat="server"  WeekNumber="1" Visible="true"/>

Similar Threads

  1. Replies: 2
    Last Post: Feb 06, 2012, 9:06 AM
  2. [CLOSED] Maximize error on Modal Window in User Control
    By jwf in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 13, 2011, 4:24 PM
  3. how to upload user control dynamicaly on user control
    By archana mahadule in forum 1.x Help
    Replies: 1
    Last Post: Jan 13, 2011, 12:05 PM
  4. Show Modal window from a User Control
    By yourspraba in forum 1.x Help
    Replies: 1
    Last Post: Jun 29, 2010, 5:43 PM
  5. Replies: 1
    Last Post: Oct 14, 2009, 8:07 AM

Posting Permissions