Home Forums WinForms controls Xceed Grid for WinForms selected item in ComboBox/WinComboBox Reply To: selected item in ComboBox/WinComboBox

User (Old forums)
Post count: 23064

This will work only on the specific editor, not on the template. When you set the CellEditorManager, this is only a template that is used to create each cells of the column. So to get the ComboBox to display a specific item, you need to get to the specific editor in that cell, which is available only once it is create, that is, when the grid is fill with data.

To get to the specific editor of a cell, you need to first activate the editor in the cell.

e.g. :

gridControl1.DataRows[ 0 ].Cells[ 0 ].EnterEdit();

Then you can use the SelectedItem property to display the item you want.

e.g. :

( ( WinComboBox )gridControl1.DataRows[ 0 ].Cells[ 0 ].CellEditorControl).SelectedItem = ( ( WinComboBox )gridControl1.DataRows[ 0 ].Cells[ 0 ].CellEditorControl).Items[ 2 ];

Note that doing this may put much overhead to the loading of the grid, depending on how many rows there is in the grid.

Imported from legacy forums. Posted by André (had 3153 views)