We are using 2006.1 Windows Forms Grids. Is there any capability built in to the grids to sort a text(string) column as a number such that 1,2222,333,44 would sort properly as 1,44,333,2222?
This would be similar to the Excel (I know I shouldn't compare the WinGrids to Excel) function "Sort anything that looks like a number, as a number".
Does anyone have any advice on how to accomplish this?
Thanks for any advice!
The best way to get around is problem like this is not to store numbers as strings. Why not use a numeric data type?
If you can't do that, then you would have to create a custom SortComparer for the grid column.
Thank you very much for the reply Mike!
I agree whole heartedly with you but this particular column is our legacy system account numbers that have the form of a string as <5digits>.<2digits>, (ex: 28078.01, 98194.04). We are nearing the point where we hit 100000.01 and that will of course throw off the sort in our grids.
Short of modifying our existing all of our account numbers by placing a 0 in front of them, or actually converting this column to a number (although this is probably the right thing to do)....
Is there any chance you may be able to point me in the direction of where I might find an example of using the sort comparer?
Also, is there any possiblity that this functionality could be included in a future version of the grid? I would be happy to submit a feature request if you could familarize me with the procedure to do this!