We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridGroupingControl: How do I make the value in one combo box cell determine the drop-down list in another combo box cell?

Hi, I have two columns in the grid. Each of these columns are foreign key references so I used sourcelists and relationships to display them as comboboxes. The second column depends on what''s in the first column but I couldn''t figure out how to setup the relationships to make that work. I tried to set a different filter on the view I am using as the source for the 2nd column but that didn''t work either - see the code segment below. I am not sure I can create a new view everytime and add it to the source list because the relationships seem to disappear. Any help is appreciated! Thanks, Manojith -------------------------------------------------- private void gridLimits_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e) { GridTableDescriptor LimitsTd = e.TableControl.TableDescriptor; int durIdx = LimitsTd.VisibleColumns.IndexOf("CalculationDurations_DurationType")+1; if (e.TableControl.CurrentCell.ColIndex == durIdx) { string frequencyId = gridLimits.Table.CurrentRecord.GetValue("EventFrequencyId").ToString(); myVF.RowFilter = string.Format("[EventFrequencyId] = ''{0}''", frequencyId); } }

2 Replies

AD Administrator Syncfusion Team December 28, 2005 02:18 PM UTC

Hi Manojith, Please try this code if (e.TableControl.CurrentCell.ColIndex == durIdx) { string frequencyId = this.gridGroupingControl1.Table.CurrentRecord.GetValue("Value_Value").ToString(); DataTable table = GetParentTable(); table.DefaultView.RowFilter = string.Format("[Value] = ''{0}''", frequencyId); string Id = table.DefaultView[0]["Key"].ToString() ; GridDropDownGridListControlCellRenderer cr = (GridDropDownGridListControlCellRenderer)e.TableControl.CurrentCell.Renderer; if(cr !=null) { GridGroupTypedListRecordsCollection tt = (GridGroupTypedListRecordsCollection) cr.ListControlPart.DataSource; tt.TableDescriptor.ResetRecordFilters(); if (tt.TableDescriptor.RecordFilters.Count == 0) { FilterCondition fc = new FilterCondition(FilterCompareOperator.Equals,Id ); RecordFilterDescriptor rfd = new RecordFilterDescriptor("Code",fc); tt.TableDescriptor.RecordFilters.Add(rfd); } } } Here is a sample for implementing it. combobox.zip Regards, Haneef


MP Manojith Padala December 29, 2005 03:26 PM UTC

Hi Haneef, Thank you for the quick response. I played with the code sample you sent me and created a small sample which is identical to the way my tables are setup. I have a Parent_Child relationship table and you don''t. I use the Parent_Child relationship table to control what''s displayed in the child combo box. The code displays some unusual behaviour. The child combo box displays the correct set of values but after the third mouse click!! Thanks, Manojith

GGCComboBoxDemo1.zip

Loader.
Live Chat Icon For mobile
Up arrow icon