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

Sfdatagrid Combobox

Thread ID:

Created:

Updated:

Platform:

Replies:

144122 Apr 19,2019 06:14 PM UTC Apr 22,2019 11:30 AM UTC WinForms 1
loading
Tags: SfDataGrid
Julius
Asked On April 19, 2019 06:14 PM UTC

I am trying to add items into a combobox for Sfdatagrid. Currently I have the combobox set up with a datasource but would like to add additional items to the combobox on cellendedit. For instance, I would like to add items into the combobox. I did this the typical datagridview through 

            var comboColumn = datagridview.Columns["Task Description"] as DataGridComboBoxColumn;
                comboColumn.Items.Add(newValue);
            

Any help would be appreciated.

Jagadeesan Pichaimuthu [Syncfusion]
Replied On April 22, 2019 11:30 AM UTC

Hi Julius, 
 
Thanks for using Syncfusion product. 

You can able to add the additional items to the datasource which is bind with ComboBox column in SfDataGrid. Please find the below code snippet here the orderInfo.ShipCityDetails is bind with DataSource of the GridComboBoxColumn, 

this.sfDataGrid1.Columns.Add(new GridComboBoxColumn() { MappingName = "ShipCityID", HeaderText = "Ship City", DisplayMember = "ShipCityName", ValueMember = "ShipCityID", DropDownStyle = DropDownStyle.DropDownList, DataSource = orderInfo.ShipCityDetails }); 


Please find the below screen shot with before adding new item to column, 
 


Now you can add the additional items in button click or any other event like below, 

private void button1_Click(object sender, EventArgs e) 
{             
    orderInfo.ShipCityDetails.Add(new ShipCityDetails() { ShipCityName = "Los Angles", ShipCityID = 137 }); 

Please find the below screen shot which shows the new item is added into the combobox, 

 


Please find the sample for your reference below, 

If we misunderstood your requirement, please provide more information regarding the requirement. This would help us to proceed further. 

Regards, 
Jagadeesan

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