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
325
Custom Sort Indicator
posted

I want to Sort my UltraWinGrid in such  a Way that for a Column Called "Grade_Type" i would like to sort my grades

as

 

A

R

B

 

i could do acesending and descending but not in the above format., I have looked at Implementing hte I comparer Interface but wasnt sucessful in coding hte same. So if you just gimme a direction it would be great.

THanks

K

Parents
No Data
Reply
  • 2334
    posted
    The IComparer is the way to go. It would look something like this:

    public class GradeTypeComparer : IComparer
    {
    private List<string> _gradeTypes = new List<string>(new string[ { "A", "R", "B" });
    public int Compare(object x, object y)
    {
    string strX = x.ToString();
    string strY = y.ToString();

    return _gradeTypes.IndexOf(strX) - _gradeTypes.IndexOf(strY);
    }
    }
Children