Linked comboboxes in a from

  1. #1

    Linked comboboxes in a from

    I have a form that contains two linked comboboxes. I can see from the linked combobox example how selecting an entry from one can influence the other. My problem is that these are both populated within a form with existing values.

    Can I use loadRecord(record) to load the form? If so how do I make sure that the lead combobox has its value for the second one to read a value from?

    I have assumed that loadRecord() cannot be used and I call a method within a refreshdata event to set the form values. The record data contains two values; one for country and one for city.

    The store with the list of countries is static and already loaded. That's great and using SetValue() on the combobox works.

    Using SetValue() on the cities combobox does assign the value but the list of cities has not been loaded.

    I have tried to databind() the store and the store is going and collecting the data but it never refreshes the combo with a list of items. That's the bit I am missing and I'm sure it's something simple but I haven't found it yet.

    Anyone?
  2. #2

    RE: Linked comboboxes in a from

    hi,

    i had the same issue and i used the following code:




    
    
    
    protected void theFirstComboBox_Select(object sender, AjaxEventArgs e)
    
    
    {
    
    
    IList<DonVi> list = new List<DonVi>()
    
    
    var selectedValue = string.Empty;
    
    
    theSeCond.RemoveAll();
    
    
    theSeCond..DataSource = list;
    
    
    theSeCond..DataBind();
    
    
    if (list.Count > 0)
    
    
    {
    
    
    selectedValue = list[0].MaDonVi;
    
    
    }
    in the first combo box selected event, have to clear all item before reload items to the second combo box.

    hope it help for you,

    Regards,
    Huy


  3. #3

    RE: Linked comboboxes in a from

    Thank you very much for your help.

    I also found out that if you have two stores with very similar names it helps to pick the right one!

    configure parameters on datasource
    store.databind
    combobox.SetValue()

    Thanks again for your help.
    I'm sorry for wasting peoples time.

    PS. Both stores called the same object function to retrieve the same list.

Similar Threads

  1. [CLOSED] Linked Comboboxes
    By romeu in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: May 11, 2012, 4:42 PM
  2. Problem with Linked ComboBoxes
    By csn in forum 1.x Help
    Replies: 3
    Last Post: Sep 24, 2010, 4:56 PM
  3. Linked ComboBoxes
    By speddi in forum 1.x Help
    Replies: 2
    Last Post: Apr 10, 2010, 3:21 PM
  4. Linked comboboxes
    By hbbazan in forum 1.x Help
    Replies: 2
    Last Post: Jan 11, 2010, 6:53 AM
  5. Linked Comboboxes
    By BrunoC in forum 1.x Help
    Replies: 4
    Last Post: Jan 29, 2009, 12:58 PM

Posting Permissions