views:

239

answers:

2

Guys and dolls,

I am wondering how to naturally sort a DataView... I really need help on this. I found articles out there that can do lists with IComparable, but I need to sort the numbers in my dataview.

They are currently alpha sorted because they are numbers with 'commas' in them. Please help me out.

I would like to find something instead of spending the time to create it my self.

P.S. expression and sortdirection work, but they of course Alpha sort. Please help.

+1  A: 

I often like to add a "SortOrder" column to results that I want to sort in a way other than is provided by the data. I usually use an integer and just add it when I am getting the data.

I don't show this column and only use it for the purposes of establishing the order.

I'm not sure if this is what you are looking for, but it is quick and easy and gives you a great deal of control.

jttraino
Can you please express more of what you mean?
Scott
Add an extra column with a width of 0 and put the same data in it formatted differently (ie. without commas, padded with zeros at the left). Then when the user wants to sort by the displayed column, make the view sort by the hidden one instead.
Zooba
Could you add some code to your explanation? I am interested in knowing how you bind a column sort to another...
m_oLogin
A: 

See these related questions:

John
Nothing in those two links. Thanks and good try.I made the first post and remade that link into this post because no one would answer my first post. It shows how people here are willing to ask opinionated questions and get answers, but not able to answer technical questions.
Scott