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
close icon

ComboBox''s datasource in GridControl

Hello! I have string collection that is used as datasource for combobox in gridcontrol''s cell. After user manually entered new value into cell, this value is also added to string collection. But combobox dropdown list does not change. I have binded string collection to gridcontrol cell once more, but it is have no effect. Best regards!

3 Replies

AD Administrator Syncfusion Team August 27, 2004 05:58 AM UTC

In our grid\samples\celltypes\comboboxes I added a gridControl1.CurrentCellValidating event in Main.cs, and also made StringCollections items a member of the form (and not a local variable). With those changes, adding a new item to teh list in CurrentCellValidating seems to work for me. The item is added as you leave the cell of the of the editable combobox using a choice list.
private void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e)
	String s = this.gridControl1.CurrentCell.Renderer.ControlText;
	if(items.IndexOf(s) == -1)
		Console.WriteLine("New Item Added");

AP Andrey Plinda August 27, 2004 08:13 AM UTC

I found a problem. If in gridcontrol property EnterKeyBehavior is set to "None", after entering new item into cell, choicelist is not updated. Only after moving to another cell''s choicelist will be updated. Is it correct?

AD Administrator Syncfusion Team August 27, 2004 08:48 AM UTC

Yes. The default behavior is to save changes when you leave the cell. If you want the changes to be saved when the dropdown closes, you can handle the CurrentCellCloseDropDown event and call grid.CurrentCell.ConfirmChanges.

Live Chat Icon For mobile
Up arrow icon