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
330
Sorting in ultra Win Grid
posted

Dear All,

  I have a column of string data type and having numerical value -1,0,1 and if i try to sorting ascending, it was display as 0,1,-1 but expected is -1,0,1. In this case only all the value are numerical but most of the case it will have combination of numeric,string and special character.

  when i compare the same behavioue with excel it was working fine. How to achieve the excpected result.

Regards

Vijay A

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Vijay,

    If the data is stored as a string, then it will be sorted as a string. The best thing to do would be to use a numeric type instead of strings.

    If you cannot do that, then you could use the SortComparer property on the column to sort the data in a custom order. What you have to do is write a class that implements the IComparer interface. There are lots of examples of this here on the forums for all sorts of custom sorting requirements.

Children