Hi,
I was trying to setup two UltraComboEditors with master-detail relations. In my dataset, there is a master table "Country", and a child table "City". They are related by the relationship Country.id = City.CountryId. I tried the following:
this->ultraComboEditorCountry->SetDataBinding(myDataset, "Country");this->ultraComboEditorCountry->DisplayMember = "Country";this->ultraComboEditorCountry->ValueMember = "id"; this->ultraComboEditorCity->SetDataBinding(myDataset, "Country.FK_Country_City");this->ultraComboEditorCity->DisplayMember = "Name";this->ultraComboEditorCity->ValueMember = "CountryId";
The second comboEditor (ultraComboEditorCity) always shows the selection from the first country's child, no matter what country I choose in the country comboEditor. Is there anything I can do to make the second comboEditor (city) automatic shows the related selections based on the country selected? Thanks!
Hi Chris,
Yes, you need to set SynchWithCurrencyManager to true on the first (country) combo.
Hi Mike,
Thanks for the info. However, I've tried setting the country comboEditor's SyncWithCurrencyManager to true, it doesn't work - still the same outcome. I've also tried setting both the country and city comboEditor's SyncWithCurrencyManager to true, but same problem happens. Any hints?
I tested this out and it worked fine for me. What version of the controls are you using? I tried it with v6.3. Here's the code I used:
DataSet ds = new DataSet(); DataTable dtCountries = ds.Tables.Add("Countries"); dtCountries.Columns.Add("PK", typeof(int)); dtCountries.Columns.Add("Name", typeof(string)); DataTable dtCities = ds.Tables.Add("Cities"); dtCities.Columns.Add("PK", typeof(int)); dtCities.Columns.Add("CountryId", typeof(int)); dtCities.Columns.Add("Name", typeof(string)); dtCountries.Rows.Add(new object[ { 0, "Country A"}); dtCountries.Rows.Add(new object[ { 1, "Country B" }); dtCountries.Rows.Add(new object[ { 2, "Country C" }); dtCities.Rows.Add(new object[ { 0, 0, "City A1"}); dtCities.Rows.Add(new object[ { 1, 0, "City A2" }); dtCities.Rows.Add(new object[ { 2, 1, "City B1" }); dtCities.Rows.Add(new object[ { 3, 1, "City B2" }); dtCities.Rows.Add(new object[ { 4, 2, "City C1" }); dtCities.Rows.Add(new object[ { 5, 2, "City C2" }); ds.Relations.Add("Country_City", dtCountries.Columns["PK"], dtCities.Columns["CountryId"]); this.ultraCombo1.SyncWithCurrencyManager = true; this.ultraCombo1.SetDataBinding(ds, "Countries"); this.ultraCombo2.SetDataBinding(ds, "Countries.Country_City");
Ah, yes, you are correct, I was using UltraCombo. It should work the same, but I tested it out and it does not work with UltraComboEditor. You should report this to Infragistics Developer Support.
Submit an incident to Infragistics Developer Support
I've tried your code - from your code I'm assuming you are using a UltraCombo rather than a UltraComboEditor, right? When I used a UltraCombo, the sync works; but when I used a UltraComboEditor, it doesn't seem to work. I'm using 2008.1 release. Is this function supported in the UltraComboEditor?