Data-bound DataGrid: Custom sorting?
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Hello, I have a DataGrid (not DataGridView) control .NET 2.0 bound to a given DataTable. One of the columns contains alphanumeric values which do not get sorted well: e.g. take the IDs A-12, A-103, B-3, ... Z-0. The default sorter of the DataGrid sorts the first two items incorrectly (A-103, A-12). If I used a custom IComparer implementation I would call string.CompareOrdinal in order to obtain the actual compare result but apparently data-bound grids cannot be sorted that way. I would definitely appreciate any suggestions to resolve this issue. I think this can be achived by creating a derived Control or by handling the SortCompare event of the DataGridView control. Thanks, Stanimir