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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

39103 Dec 27,2005 10:59 AM Dec 29,2005 10:26 AM Windows Forms 2
loading
Tags: GridControl
Manojith Padala
Asked On December 27, 2005 10:59 AM

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 09:18 AM

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 10:26 AM

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

CONFIRMATION

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.

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.

;