Thanks.
Why does it sort correctly when I add the leading 0's?
Main Topics
Browse All Topics have a Windows datagrid whose column values are
(1,10,100,1000,101,10-1,10
column's of type String), it'll sort this way
[1,10,100,1000,101,10-1,10
Explorer, when there are files with these same names , Explorer will sort
them like this: [1,2,10,10-1,11,100,101,10
How can I emulate this Windows explorer sort in my column?
Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You could write youre own compare method to the grid...
Compare(object arg1, object arg2) from the IComparer interface.
It's easy to get something like this:
1,2,10,11,100,101,103,1000
You would first check if the two items are numbers (isNum) if so, compare them normally, if bouth items are string, compare them as strings
IF one of the items is number and the other is string then the number is "smaller".
This way you could get a sort as described above... numbers in natural order, and then Strings in "natural" order.
If you don't understand something, just ask.
(Sorry i curently do not work in C#, this is the reason I don't give code, as i don't want to make syntax errors)
Business Accounts
Answer for Membership
by: AvonWyssPosted on 2004-09-14 at 13:43:19ID: 12059180
Pad the strings with leading 0s.
t(20, '0');
string sortKey=columnValue.PadLef
And then compare the sortkeys of the items you want to sort.