Home Forums WinForms controls Xceed Grid for WinForms Binding complex types to grid Reply To: Binding complex types to grid

User (Old forums)
Member
Post count: 23064

The editor does not display because there is an exception being thrown when entering in edition. The problem is that the column is of type CustomerStatus but the ValueMember of the ComboBoxEditor is a string field (“Title”).

Thus the grid cannot convert type CustomerStatus to type String in SetContolValue method.

You basically have 2 solution :

1- The column containing CustomerStatus type could contain instead a primary key of the CustomerStatus. You could then assign a ComboBoxEditor and a ComboBoxViewer to the CellEditor/ViewerManager, having as DataSource a cross-list of the two field (ID and CustomerStatus). The ValueMember would be the ID, and the DisplayFormat would be the CustomerStatus.

2- You could keep doing what you do, and make the grid display the CustomerStatus by using the ToString() method. You would need to derive from ComboBoxEditor, and override GetControlValue and SetContolValue to correctly go to and from one type and the other.

We recommend the first solution.

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