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

Combo Box in GridGroupingControl

Hi, I'm using v5.

I'm looking at your CustomFieldType_2005 sample code. I want to add a column to a gridgroupingcontrol in the same manner.

I've tried adding the code below, but I'm unsure of how to create a list of items to select from. I know it's possible to do this with a dataset and datatables but I'd prefer not to go through that trouble if it's easier like the other controls in this example.

Thanks,
Dan

table.Columns.Add("List", typeof(string));
...
gridGroupingControl1.TableDescriptor.Columns.Add("List");
...
this.gridGroupingControl1.TableDescriptor.Columns["List"].Appearance.AnyRecordFieldCell.CellType = "ComboBox";

2 Replies

HA haneefm Syncfusion Team May 24, 2007 03:09 PM UTC

Hi Dan,

You can set the style.DataSource to be the table for the entire combobox column, style.DisplayMember to be the name of the column in the table that you want to see displayed in the grid, and set style.ValueMember to be the name of the column in the table that has values that match the values originally displayed in the grid column. You also need to make it as a combobox cell. Please try the code snippet below and let me know if this helps.

this.gridGroupingControl1.TableDescriptor.Columns["List"].Appearance.AnyRecordFieldCell.CellType = "ComboBox";
this.gridGroupingControl1.TableDescriptor.Columns["List"].Appearance.AnyRecordFieldCell.DataSource = newDatatable;
this.gridGroupingControl1.TableDescriptor.Columns["List"].Appearance.AnyRecordFieldCell.ValueMember = "ColumnNameDoYouWantToseeInGrid";
this.gridGroupingControl1.TableDescriptor.Columns["List"].Appearance.AnyRecordFieldCell.DisplayMember = "ColumnNameDoYouWantTostoreInGrid";

Best regards,
Haneef


DD Dan Dorey May 24, 2007 03:33 PM UTC

Perfect! Thanks for the quick response.

Dan

>Hi Dan,

You can set the style.DataSource to be the table for the entire combobox column, style.DisplayMember to be the name of the column in the table that you want to see displayed in the grid, and set style.ValueMember to be the name of the column in the table that has values that match the values originally displayed in the grid column. You also need to make it as a combobox cell. Please try the code snippet below and let me know if this helps.

this.gridGroupingControl1.TableDescriptor.Columns["List"].Appearance.AnyRecordFieldCell.CellType = "ComboBox";
this.gridGroupingControl1.TableDescriptor.Columns["List"].Appearance.AnyRecordFieldCell.DataSource = newDatatable;
this.gridGroupingControl1.TableDescriptor.Columns["List"].Appearance.AnyRecordFieldCell.ValueMember = "ColumnNameDoYouWantToseeInGrid";
this.gridGroupingControl1.TableDescriptor.Columns["List"].Appearance.AnyRecordFieldCell.DisplayMember = "ColumnNameDoYouWantTostoreInGrid";

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon