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

Reading Combobox Value in Databound Grid

Hi I'm currently working on a databound grid that must enable/disable certain cells depending on the selected value in a combobox in another cell. When I try to set the Enabled flag for these other cells in QueryCellInfo I've found that the CellValue of the combobox returned from the grid indexer is the previously selected combobox value, not the current one. I do know that after a RowLeave event has fired the correct combobox value is available via the indexer in QueryCellInfo. This behaviour seems a little strange since I know I will always get the correct current value of a checkbox using the indexer from within QueryCellInfo, do comboboxes have to be handled differently? Regards Stuart Dent

2 Replies

AD Administrator Syncfusion Team August 6, 2003 09:39 AM UTC

For most cells, including comboboxes, the changed values are not moved into the grid until the user confirms the change by moving to another cell. For checkboxes, this is not the case. The check is stored whenever the value changes whether or not the cell still has input focus. So, I suspect the problem you are seeing is that the user drops the combobox and makes a selection, but the dependent cell does not change immediately. If you click off the combobox cell, then the dependent cell should change (provided it has to repaint for some reason). If this is the case, then one way to try to get the change to register immediately is to handle the CurrentCellCloseDropDown event, and if the CurrentCell.ColIndex points to your combobox column, then call CurrentCell.ConfirmChanges(). This should force the value to be saved as soon as the combobox closes.


SD Stuart Dent August 6, 2003 11:23 AM UTC

> For most cells, including comboboxes, the changed values are not moved into the grid until the user confirms the change by moving to another cell. For checkboxes, this is not the case. The check is stored whenever the value changes whether or not the cell still has input focus. > > So, I suspect the problem you are seeing is that the user drops the combobox and makes a selection, but the dependent cell does not change immediately. If you click off the combobox cell, then the dependent cell should change (provided it has to repaint for some reason). > > If this is the case, then one way to try to get the change to register immediately is to handle the CurrentCellCloseDropDown event, and if the CurrentCell.ColIndex points to your combobox column, then call CurrentCell.ConfirmChanges(). This should force the value to be saved as soon as the combobox closes. Thanks Clay, I suspect that making the call to ConfirmChanges will solve the problem. Regards Stuart Dent

Loader.
Live Chat Icon For mobile
Up arrow icon