Linked combo boxes not showing data

  1. #1

    Linked combo boxes not showing data

    Hi,

    In my app I have four Combos that are linked.

    - Selection of combo 1 fetches and displays data for combo 2.
    - Selection of combo 2 fetches and displays data for combo 3...and so on.

    I have checked the example - https://examples1.ext.net/#/Form/Com...ed_ComboBoxes/ but haven't fully followed it since I don't need to load combo data using any proxy. In my 1st combo, I set a DirectEvent on Select which is calling a handler and this call is running neatly. In that handler im taking 1st combo's selected value as param, fetching data and binding it for 2nd combo. I can see all these going nicely in debug mode but my 2nd combo is not displaying any data. Any idea? Im providing my code snippets below. Thanks in advance.

    
    <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!X.IsAjaxRequest)
                {
    
                }
    
                if (!IsPostBack)
                {
                    if (ShowCountry)
                    {
                        BindCountryDDL();
                    }
                }
            }
    
    
            protected void Country_Changed(object sender, DirectEventArgs e)
            {
                    BindDivisionDDL(this.ddlCountry.SelectedItem.Value);
            }
    
            /// <summary>
            /// Private method to load Division drop down
            /// </summary>
            private void BindDivisionDDL(string countryOID)
            {
                IList<Division> divisionList;
    
                ddlDivision.Items.Clear();
    
                if (!string.IsNullOrEmpty(countryOID))
                {
                    divisionList = new DivisionManager(false).GetAllDivisionByCountry(countryOID);
                }
                else
                {
                    divisionList = new DivisionManager(false).GetAllDivision();
                }
    
                foreach (Division division in divisionList)
                {
                    string textField = string.Empty;
                    string valueField = string.Empty;
    
                    if (UtilityCommon.GetCurrentCulture().Equals(AMMSConstants.SITE_CULTURE_BN))
                    {
                        textField = division.DivisionName_BN;
                    }
                    else
                    {
                        textField = division.DivisionName;
                    }
    
                    valueField = division.OID;
    
                    ddlDivision.Items.Add(new ListItem(textField, valueField));
                }
    
                if (!string.IsNullOrEmpty(UtilityCommon.GetValueFromHttpQueryString(this.Request, AMMSConstants.QUERY_STRING_PARAM_DIVISION_OID)))
                {
                    ddlDivision.SelectedItem.Value = UtilityCommon.GetValueFromHttpQueryString(this.Request, AMMSConstants.QUERY_STRING_PARAM_DIVISION_OID);
                    ddlDivision.Selectable = false;
                }
                else
                {
                    ddlDivision.Selectable = true;
                }
    
                ddlDivision.DataBind();
            }
        
    </script>
    
    
        <ext:Panel ID="pnlCommonSettingSearch" Icon="CameraMagnify" runat="server" AutoHeight="True" Floating="false" AnchorHorizontal="100%"
            AutoWidth="True" Title="Search">
            <Content>
                <table style="width: 100%;">
                    <tr>
                        <td style="width: 50%;">
                            <ext:Store ID="storeParent" runat="server"/>
    
                            <ext:ComboBox 
                                ID="ddlCountry" runat="server" 
                                FieldLabel="Country " 
                                Editable="false"
                                TypeAhead="true" 
                                Mode="Local"
                                ForceSelection="true"
                                TriggerAction="All"            
                                SelectOnFocus="true"
                                Width="250" Visible="false" 
                                EmptyText="-- Select Country --">
    
                                <DirectEvents>
                                    <Select onevent="Country_Changed"/>
                                </DirectEvents>
    
    <%--                            <Listeners>
                                    <Select Handler="#{ddlDivision}.clearValue();#{CitiesStore}.load();" />
                                </Listeners>
    --%>
                            </ext:ComboBox>
                        </td>
                        <td style="width: 50%;">
                            <ext:ComboBox ID="ddlDivision" runat="server" 
                                        Editable="false"
                                        TypeAhead="true" 
                                        Mode="Local"
                                        ForceSelection="true"
                                        TriggerAction="All"            
                                        SelectOnFocus="true"
                                        ValueNotFoundText="Loading..."
                                        Width="250" Visible="false" EmptyText="-- Select Division --">
                            </ext:ComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 50%;">
                            <ext:ComboBox ID="ddlDistrict" runat="server" FieldLabel="District " 
                                        Editable="false"
                                        TypeAhead="true" 
                                        Mode="Local"
                                        ForceSelection="true"
                                        TriggerAction="All"            
                                        SelectOnFocus="true"
                                        ValueNotFoundText="Loading..."
                                Width="250" Visible="false" EmptyText="-- Select District --">
                            </ext:ComboBox>
                        </td>
                        <td style="width: 50%;">
                            <ext:ComboBox ID="ddlUpazilla" runat="server" FieldLabel="Upazilla " 
                                        Editable="false"
                                        TypeAhead="true" 
                                        Mode="Local"
                                        ForceSelection="true"
                                        TriggerAction="All"            
                                        SelectOnFocus="true"
                                        ValueNotFoundText="Loading..."
                                Width="250" Visible="false" EmptyText="-- Select Upazilla --">
                            </ext:ComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 50%;">
                            <ext:TextField ID="txtCode" runat="server" FieldLabel="Code " Width="250px" Visible="false" EmptyText="Enter Code.."/>
                        </td>
                        <td style="width: 50%;">
                            <ext:TextField ID="txtName" runat="server" FieldLabel="Name " Width="250px" Visible="false" EmptyText="Enter Name.."/>
                        </td>
                    </tr>
                </table>
            </Content>
        </ext:Panel>
  2. #2
    Try to replace
    ddlDivision.DataBind();
    by

    ddlDivision.GetStore().DataBind();
  3. #3
    Vladimir, it worked like magic! Thanks man. You are awesome. Thanks a ton. :)

Similar Threads

  1. Linked Combo boxes with radio gruop
    By speddi in forum 1.x Help
    Replies: 3
    Last Post: May 29, 2010, 11:14 AM
  2. [1.0] Combo boxes not editable.
    By michaeld in forum 1.x Help
    Replies: 1
    Last Post: May 20, 2010, 10:49 AM
  3. Problem using coolite combo boxes
    By virus in forum 1.x Help
    Replies: 3
    Last Post: Sep 19, 2009, 12:28 AM
  4. Linked Combo Boxes within a Grid View
    By johnharp in forum 1.x Help
    Replies: 0
    Last Post: Sep 15, 2009, 11:07 AM
  5. Linked Combo Boxes using DataSources
    By rthiney in forum 1.x Help
    Replies: 3
    Last Post: Aug 06, 2009, 12:36 PM

Posting Permissions