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

Populate a Combo box that is in a "AddNewRecord" Row

Winform desktop app, Net 4.6, GridGroupingControl, Add New Record = True.  The new record input row is at the top of the grid.  The first column is a ComboBox that I need to fill with values from a database query.  The person adding the new record can then select the value from the combobox.

I've searched, tested, dug through all the docs and APIs online, loaded and explored the demos and simply can't find any examples or figure out how to populate that combo box from the results from a database query when the form is displayed and the grid is populated.  Either it's so simple I'm missing it or I'm not making the connection to the multitude of options available on a gridgroupingcontrol.

The next step in this would be displaying the combo box, in a record row, with the query results AND THEN setting the selected value to the row record's value.

Any pointers, links to information and examples, or other info would be greatly appreciated.

1 Reply

FP Farjana Parveen Ayubb Syncfusion Team July 15, 2019 05:51 AM

Hi Mike, 
Thanks for using Syncfusion products. 
By default, the ComboBox column datasource of the recordrow will be set to AddNewRecordRow combobox column also. In order to set the datasource, the datatable can be retrieved by using the query and set to the particular column. Please refer to the below code to set the data source for the ComboBox column, 
Code example 
//To set the column type as combobox. 
this.gridGroupingControl1.TableDescriptor.Columns["GridColumnName"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.ComboBox; 
this.gridGroupingControl1.TableDescriptor.Columns["GridColumnName _Name"].Appearance.AnyRecordFieldCell.DataSource = comboTable;(datatable retrieved using query) 
this.gridGroupingControl1.TableDescriptor.Columns["GridColumnName _Name"].Appearance.AnyRecordFieldCell.DisplayMember = "Col"; 
this.gridGroupingControl1.TableDescriptor.Columns["GridColumnName _Name"].Appearance.AnyRecordFieldCell.ValueMember = "ID"; 
Please let us know, if you have any other queries. 
Farjana Parveen A 

Live Chat Icon For mobile
Up arrow icon