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

Using a combobox in a cell

1) Is there a way to use a comboBbx in a cell without the user being able to chose other values than the ones is the combobox? I've tried setting ExclusiveChoiceList to true, but if you hit the Delete-button and press enter you are able to leave the cell blank! 2) Is there a way to have a ComboBox in a cell with the text in the cell being bold when it is collapsed, but without having the elements in the combobox shown as bold text, when it is "dropped down"... Sincerely, Kenneth

6 Replies

AD Administrator Syncfusion Team May 28, 2003 06:49 PM UTC

> 1) Is there a way to use a comboBbx in a cell without the user being able to chose other values than the ones is the combobox? I've tried setting ExclusiveChoiceList to true, but if you hit the Delete-button and press enter you are able to leave the cell blank! > > 2) Is there a way to have a ComboBox in a cell with the text in the cell being bold when it is collapsed, but without having the elements in the combobox shown as bold text, when it is "dropped down"... > > Sincerely, > Kenneth 1) Try to listen to the ClearingCells event and set e.Cancel = true. 2) Try CurrentCellShowedDropDown. There you can then get to the dropped down listbox and change its font. Something like ComboBoxCellRenderer cr = CurrentCell.Renderer; cr.ListBoxPart.Font = new Font(xxx) Stefan


AD Administrator Syncfusion Team May 28, 2003 08:33 PM UTC

1) The GridClearingCellsEventArgs doesn't have a Cancel-property... :( 2) You probably mean GridComboBoxRenderer... but anyway, I simply cannot make it work! I get no changes at all! Could you show a small example? Kenneth


AD Administrator Syncfusion Team May 28, 2003 09:13 PM UTC

Attached is a sample that shows the text bold, but the combo droplist regular. It uses CurrentCellShowingDropDown to do this. The ClearingCells event args has an e.Handled that you set to indicate that you handled the clearing. In the attached sample, I added this event too, but it is not needed here as pressing Delete does not clear the cell. If you are using a GridDataBoundGrid, then that might explain the deleting problem, but setting e.Handled in ClearingCells should prevent this.


CC Charles Carlin June 3, 2003 11:42 AM UTC

I am having the same problem. I added the ClearingCells event and set e.handled=true like in your example and the event is never fired when I press the delete key. This is in a databound grid control, with a combobox set to exclusive.


AD Administrator Syncfusion Team June 3, 2003 12:03 PM UTC

ClearingCells is only hit when you select a range of cells. Pressing delete on an active cell will not fire it. What grid version are you using? With the 1.6 beta code, if I have ExclusiveChoiceList = true, then pressing delete on the combobox does not delete the entry. Attached is the little sample I used. If you want to try the 1.6 code base, you can submit a Direct Trac support incident and request it.


CC Charles Carlin June 3, 2003 12:31 PM UTC

Actually I found that if I add the gridControl1_CurrentCellDeleting event and set e.canel=true along with the gridControl1_ClearingCells event e.handled=true then it does work.

Loader.
Up arrow icon