Sorting a column containing a Combobox in a DataGrid

  • Thread starter Thread starter Dominique
  • Start date Start date
D

Dominique

I have a DataGrid that contains a custom
DataGridTextBoxColumn that can display a DataBound
ComboBox. (See
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q480q)

The underlying value of that column is an Int32 but the
DataGridColumnStyle translates that
value to a text string for display using a DataTable and
a Relation.
This implementation works well for displaying and editing
the data using the textual descriptions.

My problem is that if I permit the user to sort the
DataGrid and they choose to sort on that column that the
DataGrid will automatically sort based on the underlying
Int32 value instead of the textual description. Is it
possible to override this behavior to provide custom
sorting rules so that I could compare the descriptions
myself, or does anybody have any recommendations as to
other methodologies I could examine?

I thank you in advance.
Dominique.
 
Hi Dominique,

I realize very well that this is a kind of "dirty hack", but you can map
Int32 values to textual values in such a way that the sort order for both of
them will be the same, something like this:

1 = "Albert"
2 = "Dennis"
3 = "Eric"
 
Back
Top