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

ComboBox selection event

Thread ID:





47812 Aug 12,2006 09:18 PM UTC Aug 16,2006 12:22 PM UTC WinForms 4
Tags: GridControl
Asked On August 12, 2006 09:18 PM UTC

I''m trying to update a field on my form when a the value of a ComboBox in my virtual grid is changed.

I couldn''t find any event analogous to SelectionChangeCommitted and the CurrentCellCloseDropDown event isn''t 100% reliable for this as some of my users type their value rather than use the mouse to select it from the drop down.

How can I go about either capturing when the value is changed prior to the cell being exited or better yet, cause a change of the selected value to be saved immediately (performance shouldn''t be an issue, the list is 4 items).

Administrator [Syncfusion]
Replied On August 14, 2006 04:11 AM UTC

Hi Rich,

You can access the GridComboBoxCellRenderer and can subscribe the SelectedValueChanged event to detect the selected item in a ComboBox cell.

//Form Load....
GridComboBoxCellRenderer cr = this.grid.CellRenderers["ComboBox"] as GridComboBoxCellRenderer;
if( cr != null)
cr.ListBoxPart.SelectedValueChanged+=new EventHandler(ListBoxPart_SelectedValueChanged);

private void ListBoxPart_SelectedValueChanged(object sender, EventArgs e)
ListBox list = sender as ListBox;
DataRowView row = list.SelectedItem as DataRowView;
if( row != null)

Best Regards,

Replied On August 14, 2006 01:33 PM UTC

Thanks Haneef,

Exactly what I needed. Now, how would I force a commit of the selected value at that point? And do you see any problem with that approach?


ps - since I''m asking -

I have some columns for displaying currency. Some are editable, some are not. The users want decimal places to 5 places but they only want to see the significant places beyond 2 places.

For example,
2 should show as 2.00
2.5 should show as 2.50
2.55 should show as 2.55
2.551 should show as 2.551
2.55100 should show as 2.551

How can I achieve this?

Administrator [Syncfusion]
Replied On August 16, 2006 06:05 AM UTC

Hi Rich,

Issue 1:
To commit the current cell change in a grid, you need to call the CurrentCell.EndEdit and Binder.EndEdit method in ListBoxPart''s SelectedValueChanged event.

Issue 2:
The DrawCellDisplayText event can be handled and there the cell value can be parsed and the resultant simple string can be set to the e.DisplayText. Please refer the attached sample for more details.

Here is a Sample.

Let me know if this helps.
Best Regards,

Administrator [Syncfusion]
Replied On August 16, 2006 12:22 PM UTC

Thanks Haneef,
I had settled on CurrentCell.ConfirmChanges() but I will switch to using CurrentCell.EndEdit().


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

or the page will be automatically redirected to 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