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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:





39103 Dec 27,2005 03:59 PM UTC Dec 29,2005 03:26 PM UTC WinForms 2
Tags: GridControl
Manojith Padala
Asked On December 27, 2005 03:59 PM UTC

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); } }

Administrator [Syncfusion]
Replied On 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

Manojith Padala
Replied On 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



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon