Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2732
Sorting an enum column
posted

Hello,

I have a column in a grid containing a enum. Sorting it does not go as I would want.

Enum:

public enum Priority {
     Low = 0,
     Medium = 1,
     High = 2 }

I want the column to sort on the enum value, not the text, so 0,1,2. Currently it's sorting Low -> High -> Medium instead of Low -> Medium -> High.

I have found the following article, which explains how to sort one column based on another column, which I can apply to this problem:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7695

Is there no buildin way to sort an enum column on the value instead of text, instead of having to implement a comparer and stuff ?

Kind regards,

Michael