Articles in this section
Category / Section

How to sort the enum type column?

2 mins read

By default, the enumeration column is sorted based on the enum flags. So, the display values of that column are different from the normal column sorting. When you want to sort the enumeration column based on the values displayed, you can handle it by changing the CellValueType of the column as string.

C#

//changes the CellValueType as string of Enum column
this.gridGroupingControl1.TableDescriptor.Columns["Enum"].Appearance.AnyRecordFieldCell.CellValueType = typeof(string);

 

VB

‘changes the cell value type as string of Enum column
Me.gridGroupingControl1.TableDescriptor.Columns("Enum").Appearance.AnyRecordFieldCell.CellValueType = GetType(String)

 

The following screenshot displays the sorting of Enum column.

F:\Winforms\KB\DataGrid\EnumColumn\WindowsFormsApplication21\EnumColumn.png

 

Sample Links:

C#: SortEnumColumn

VB: SortEnumColumn

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied