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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

145906 Jul 12,2019 02:23 PM UTC Jul 15,2019 10:51 AM UTC WinForms 1
loading
Tags: GridGroupingControl
Mike Potratz
Asked On July 12, 2019 02:24 PM UTC

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.

Farjana Parveen Ayubb [Syncfusion]
Replied On July 15, 2019 10:51 AM UTC

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. 
  
Regards, 
Farjana Parveen A 


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.

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

Live Chat Icon For mobile
Live Chat Icon