Combox box selected values,Texts assign to Hidden field

  1. #1

    Combox box selected values,Texts assign to Hidden field

    I have two grid, One is parent grid and another is child grid. If i add location name in the parent grid then I retreive that values into child grid Address combo box , After that I need to assign all combo box values,texts into Hidden Contol then I will do logic for Save functionality.

    I just used Select Handler to implement in the below code, But i am not able to get all selected combo box values, Please assist me on this



    Listeners>                                 
    <Select Handler="#{Hidden1}.setValue(#{Hidden1}.getValue() +';'+#{cbxAddress}.getValue()+','+#{cbxAddress}.getRawValue());"/>                                 
    </Listeners>
    Complete Test Cases:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestLoadCombo.aspx.cs" Inherits="JobsPortal.TestLoadCombo" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            this.storeAddress.DataSource = Address.GetAll();
            this.storeAddress.DataBind();
           
            
        }
    
        protected void btnSubmit_Click(object sender, DirectEventArgs e)
        {
            string str = Hidden1.Text;
        }
    
        public class Address
        {
            public int ID { get; set; }
            public string Location { get; set; }
            public string Fax { get; set; }
    
            public static List<Address> GetAll()
            {
                return new List<Address>
                           {
                               new Address {ID = 0, Location = "Main Office",Fax="12345"}
                              
                           };
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>Retrieving Parent grid Text data into child grid combo box</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    
        <script>
            var AddressRenderer = function (value) {
                
                var r = App.storeAddress.getById(value);
                
                if (Ext.isEmpty(r)) {
                    return "";
                }
                return r.data.Location;
            };
    
           
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
             <ext:Store ID="storeAddress" runat="server">
                <Model>
                    <ext:Model ID="Model3" runat="server" IDProperty="ID">
                        <Fields>
                            <ext:ModelField Name="ID" Type="Int" />
                            <ext:ModelField Name="Location" />
                             <ext:ModelField Name="Fax" />
                        </Fields>
                        <IDGen>
                    <ext:SequentialIdGenerator />
                </IDGen>
                    </ext:Model>
                </Model>
            </ext:Store>
    
            
         
            <ext:Store ID="StoreLocation" runat="server" >
                        <Model>
                            <ext:Model ID="Model2" runat="server" IDProperty="ID">
                                <Fields>
                                    <ext:ModelField Name="ID" Type="Int" />
                                    <ext:ModelField Name="Name" />                            
                                    <ext:ModelField Name="AddressID" />
                                </Fields>
                            </ext:Model>
                        </Model>
             </ext:Store>
            
    
            <ext:Panel ID="Panel1" 
                runat="server" 
                Title="Parent Grid"
                Width="600" 
                Height="200"
                Layout="FitLayout">
                <Items>
              <ext:GridPanel ID="grdpnlEmployerProfile_Address" 
                Height="100"
                runat="server"
                Title="Address Parent Grid" 
                Icon="Application" StoreID="storeAddress">
                   <TopBar>
    				 <ext:Toolbar ID="tlbrEmployerProfile_Address" runat="server">
    					<Items>
    					<ext:Button ID="btnNewEmployerProfile_Address" runat="server" Icon="Add" Text="New">
    					<Listeners>  
                        <Click Handler="var grid1 = #{grdpnlEmployerProfile_Address},
                         store1 = grid1.store;                                                              
                         store1.insert(0, {                                                                                                                                   
    					});                                                                
    					#{grdpnlEmployerProfile_Address}.getView().refresh(false);
    					#{grdpnlEmployerProfile_Address}.getSelectionModel().select(0);
    					#{grdpnlEmployerProfile_Address}.getView().focusRow(0);
    					grid1.editingPlugin.startEdit(0, 1);" />  
                         </Listeners> 
                         </ext:Button>
    										        </Items>
    									        </ext:Toolbar>  
    								        </TopBar>
                                                                   
                              <ColumnModel ID="ColumnModel2" runat="server">
                    <Columns>
                         <ext:RowNumbererColumn ID="RowNumbererColumn2" runat="server" />	
                        <ext:Column ID="Column5" runat="server" Text="Location" DataIndex="Location" >
                        <Editor>
                        <ext:TextField ID="txtLocationName" runat="server" AllowBlank="False" MaxLength="20" MinWidth="5"></ext:TextField>
                        </Editor>
                        </ext:Column>
    
                        <ext:Column ID="Column6" runat="server" Text="Fax" DataIndex="Fax" >
                        <Editor>
                        <ext:TextField ID="txtFax" runat="server" AllowBlank="False" MaxLength="20" MinWidth="5"></ext:TextField>
                        </Editor>
                        </ext:Column>
                      
                        
                    </Columns>
                </ColumnModel>
    
                  <View>                
                        <ext:GridView ID="GridView1" runat="server">                                                
    <%--<GetRowClass Handler="alert(record[0].data.LocationName);"/>--%>
                           <%--<GetRowClass Handler="window.alert(rowParams);" />--%>
                        </ext:GridView>                                  
                        <%-- <GetRowClass Handler="if (record[0].data.LocationName=='Main Office') {return 'x-hidden';}" />--%>
                  </View> 
                <Plugins>
                    <ext:CellEditing ID="CellEditing2" runat="server" />
                </Plugins>
            </ext:GridPanel>
                    </Items>
                </ext:Panel>
    
             <ext:Panel ID="Panel2" 
                runat="server" 
                Title="Child Grid"
                Width="600" 
                Height="200"
                Layout="FitLayout">
                <Items>
    
            <ext:GridPanel ID="grdpnLocation" 
                Height="100"
                runat="server"
                Title="Location Child Grid" 
                Icon="Application" StoreID="StoreLocation">
                 <TopBar>
    			<ext:Toolbar ID="Toolbar1" runat="server">
    				 <Items>
    				<ext:Button ID="Button1" runat="server" Icon="Add" Text="New">
    				 <Listeners>  
                    <Click Handler="var grid2 = #{grdpnLocation},
                     store2 = grid2.store;                                                              
                      store2.insert(0, {                                                                                                                                   
    				 });                                                                
    				 #{grdpnLocation}.getView().refresh(false);
    				#{grdpnLocation}.getSelectionModel().select(0);
    				#{grdpnLocation}.getView().focusRow(0);
    				grid2.editingPlugin.startEdit(0, 1);" />  
                     </Listeners> 
                     </ext:Button>
    				</Items>
    				</ext:Toolbar>  
    				</TopBar>
               
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                         <ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" />	                  
                        <ext:Column ID="Column2" runat="server" Text="NAME" DataIndex="Name" >  
                         <Editor>
                        <ext:TextField ID="TxtName" runat="server" AllowBlank="False" MaxLength="20" MinWidth="5"></ext:TextField>
                        </Editor>
                        </ext:Column>
                   
                        <ext:Column ID="Column4" runat="server" Text="ADDRESS" DataIndex="AddressID" Width="240">
                        <Renderer Fn="AddressRenderer" />
                             
                            <Editor>
                                <ext:ComboBox ID="cbxAddress" 
                                    runat="server"     
                                    QueryMode="Local"   
                                    Editable="false"                     
                                    StoreID="storeAddress" 
                                    DisplayField="Location" 
                                    ValueField="ID">                               
                                  <Listeners>                                 
                                <Select Handler="#{Hidden1}.setValue(#{Hidden1}.getValue() +';'+#{cbxAddress}.getValue()+','+#{cbxAddress}.getRawValue());"/>
                                     
                                  </Listeners>
                                  </ext:ComboBox>
                                
                            </Editor> 
                        </ext:Column>
                    </Columns>
                </ColumnModel>
                <Plugins>
                    <ext:CellEditing ID="CellEditing1" runat="server" />
                </Plugins>
            </ext:GridPanel>
                    </Items>
                 </ext:Panel>
            <ext:Label runat="server" ID="lblhidden" Text=""></ext:Label>
            <ext:Hidden ID="Hidden1" runat="server"/>
             <ext:Button ID="btnSubmitNew" runat="server" Hidden="False" 
                                            StandOut="True" Text="Submit">
                                            
                                         <DirectEvents>
                                                <Click OnEvent="btnSubmit_Click" Timeout="1800000">
                                                    <ExtraParams>                    
                                                        <ext:Parameter Name="Save" Mode="Value" Value="NEW" />
                                                       
                                                    </ExtraParams>
                                                    <EventMask ShowMask="True" Msg="Processing..." MinDelay="500" />
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
        </form>
    </body>
    </html>
    Last edited by yenkarthi; Oct 01, 2015 at 7:21 AM.

Similar Threads

  1. Replies: 0
    Last Post: Feb 23, 2012, 1:42 PM
  2. Replies: 5
    Last Post: Jun 08, 2011, 12:19 PM
  3. Replies: 1
    Last Post: Jan 31, 2011, 8:45 AM
  4. Replies: 2
    Last Post: Sep 07, 2010, 8:42 AM
  5. [CLOSED] [1.0] Assign custom values to RadioGroup items
    By SandorD in forum 1.x Premium Help
    Replies: 2
    Last Post: Feb 22, 2010, 9:20 AM

Tags for this Thread

Posting Permissions