Selecting new item in GridViewComboBoxColumn cell is ignored when clicking on another GUI item

1 Answer 26 Views
GridView
Toby
Top achievements
Rank 3
Iron
Iron
Toby asked on 16 Feb 2022, 04:10 PM | edited on 16 Feb 2022, 06:06 PM

Hi,

I have a RadGridView which uses a GridViewComboBoxColumn, I populate the combo box list at run time using the CellEditorInitialized  event handler. My issue is that when the user selects on a new item in the combobox and then clicks on a menu item (such as FileSave) or rad ribbon button then the new combo value is discarded. I notice the CellEndEdit event is also not fired.

If I select another cell in the grid then everything works as expected (ie CellEndEdit event is fired)

Is this a known issue and is there a workaround I could use ?

Or is it possible to always close the drop down list and call EndEdit when a selection is made?

Regards

Toby

Toby
Top achievements
Rank 3
Iron
Iron
commented on 17 Feb 2022, 10:58 AM

Found a workable solution. I'm now creating an event handler for DropDownListEditorElement.SelectedValueChanged from within CellEditorInitialised which in my case sets the underlying data to the value selected.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Feb 2022, 12:32 PM

Hello, Toby,

Please have in mind that GridViewComboBoxColumn accepts only valid values according to the applied GridViewComboBoxColumn.DataSource collection. If in the CellEditorInitialized event another DataSource collection is applied to the RadDropDownListEditor, all items that are not present in the GridViewComboBoxColumn.DataSource wouldn't be considered as valid. Hence, their value wouldn't be preserved to the cell. 

If you want to apply a different set of items for the editor, note that the GridViewComboBoxColumn.DataSource collection must contain all possible values. Then, in the CellEditorInitialized event only the desired subset of items can be set. This scenario is commonly known as cascading comboboxes. I would recommend you to have a look at the following KB article which demonstrates a sample approach how to handle this situation.

https://docs.telerik.com/devtools/winforms/knowledge-base/cascading-comboboxes-in-radgridview 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
Toby
Top achievements
Rank 3
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or