Link combo box problem!!!!!!!!!!!!!!!!!!!!!!

  1. #1

    Link combo box problem!!!!!!!!!!!!!!!!!!!!!!

    Hi all,

    I want to use link combo box but it have any problems. I spend too much my time but don't resolve it.

    Please get my sample project http://www.4shared.com/file/Bxg-u5Up/WebSites.html , it have 3 folders:
    1. Data folder: contains the script to create database (sql 2008)
    2. Web site folder: contains the UI code
    3. Lib folder: contains some dll reference file.

    or see following code:

    HTML code:
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <html>
    <head>
    <title></title>
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server">
        </ext:ResourceManager>
        <ext:ComboBox ID="cboCountry" runat="server" Width="200" FieldLabel="Quốc gia" DisplayField="Name"
            ValueField="ID" TypeAhead="true" Mode="Local" Editable="true" ForceSelection="true"
            TriggerAction="All" EmptyText="Chọn quốc gia" SelectOnFocus="true" LabelSeparator="<font color=red>*</font>"
            LoadingText="Đang tải dữ liệu ...">
            <Store>
                <ext:Store ID="Store1" runat="server">
                    <Reader>
                        <ext:JsonReader IDProperty="ID">
                            <Fields>
                                <ext:RecordField Name="ID" />
                                <ext:RecordField Name="Code" />
                                <ext:RecordField Name="Name" />
                            </Fields>
                        </ext:JsonReader>
                    </Reader>
                </ext:Store>
            </Store>
            <Template ID="Template1" runat="server">
                <Html>
                <tpl for=".">
                                          <div class="x-combo-list-item">{Code:htmlEncode} - {Name:htmlEncode}</div>   
                                    </tpl>
                </Html>
            </Template>
            <Triggers>
                <ext:FieldTrigger Icon="Clear" HideTrigger="true" Qtip="Bỏ chọn" />
            </Triggers>
            <Listeners>
                <Select Handler="this.triggers[0].show();" />
                <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                <TriggerClick Handler="if (index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
            </Listeners>
            <DirectEvents>
                <Select OnEvent="OnCountrySelect">
                </Select>
            </DirectEvents>
        </ext:ComboBox>
        <ext:ComboBox ID="cboCity" runat="server" Width="200" FieldLabel="Tỉnh thành" DisplayField="DisplayName"
            ValueField="ID" TypeAhead="true" Mode="Local" Editable="true" ForceSelection="true"
            TriggerAction="All" EmptyText="Chọn tỉnh, thành" SelectOnFocus="true" LabelSeparator="<font color=red>*</font>"
            LoadingText="Đang tải dữ liệu ...">
            <Store>
                <ext:Store ID="storeCity" runat="server">
                    <Reader>
                        <ext:JsonReader IDProperty="ID">
                            <Fields>
                                <ext:RecordField Name="ID" />
                                <ext:RecordField Name="Name" />
                                <ext:RecordField Name="DisplayName" />
                            </Fields>
                        </ext:JsonReader>
                    </Reader>
                </ext:Store>
            </Store>
            <Template ID="Template2" runat="server">
                <Html>
                <tpl for=".">
                                          <div class="x-combo-list-item">{Name:htmlEncode} - {DisplayName:htmlEncode}</div>   
                                    </tpl>
                </Html>
            </Template>
            <Triggers>
                <ext:FieldTrigger Icon="Clear" HideTrigger="true" Qtip="Bỏ chọn" />
            </Triggers>
            <Listeners>
                <Select Handler="this.triggers[0].show();" />
                <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                <TriggerClick Handler="if (index == 0) { this.clearValue(); this.triggers[0].hide(); }" />
            </Listeners>
        </ext:ComboBox>
        </form>
    </body>
    </html>
    and behind code:

    protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                var systemConfigService = ServiceFacade.CreateSystemConfigService();
                var catalogService = ServiceFacade.CreateCatalogService();
                var cityService = ServiceFacade.CreateCityService();
    
                var countries =
                    (List<Catalog>) catalogService.GetCatalogByTypeDisplayOrder((int) Constants.CatalogType.National).Source;
    
                var storeCountry = cboCountry.Store.Primary;
                storeCountry.DataSource = countries;
                storeCountry.DataBind();
    
                var selectedCountryId = ((Catalog)
                                       catalogService.GetCatalogByCode(
                                           systemConfigService.GetByKey(Constants.SystemConfigKey.DEFAULT_NATIONAL))
                                           .Source).ID;
                cboCountry.SelectedItem.Value = selectedCountryId.ToString();
    
                var cities = (List<City>) cityService.GetByCountry(selectedCountryId).Source;
                var storeCity = cboCity.Store.Primary;
                storeCity.DataSource = cities;
                storeCity.DataBind();
            }
        }
    
        protected void OnCountrySelect(object sender, DirectEventArgs e)
        {
            var cityService = ServiceFacade.CreateCityService();
            var cities = (List<City>)cityService.GetByCountry(new Guid(cboCountry.SelectedItem.Value)).Source;
            var storeCity = cboCity.Store.Primary;
            storeCity.DataSource = cities;
            storeCity.DataBind();
        }
    My problem is:

    1. i want to reload the second combo box when the first combo box is selected.
    2. can i use the paging for my combo box ???


    Regards,
    Huy
  2. #2
    Help me please!!!!!!!!!!!!!!!!
  3. #3
    sorry for this trouble. It's my mistake. I found solution from this sample:
    https://examples1.ext.net/#/Form/ComboBox/Ajax_Linked_Combos/


    Sorry and please close this topic for me!

    Thanks,
    Huy
    Last edited by huynd; Aug 27, 2010 at 10:19 AM.

Similar Threads

  1. TreeGrid, problem using link
    By arthur86 in forum 1.x Help
    Replies: 1
    Last Post: Aug 29, 2011, 12:33 PM
  2. Problem with paging in combo box
    By t2kien in forum 1.x Help
    Replies: 0
    Last Post: Nov 10, 2010, 9:34 AM
  3. Linked Combo Box Problem
    By ary sucaya in forum 1.x Help
    Replies: 0
    Last Post: Jun 04, 2010, 11:40 AM
  4. Combo Box Problem
    By jpmcm88 in forum 1.x Help
    Replies: 2
    Last Post: Jul 15, 2009, 2:59 PM
  5. HtmlEditor link problem
    By designworxz in forum 1.x Help
    Replies: 0
    Last Post: Feb 03, 2009, 12:32 AM

Posting Permissions