DataView sorting

jonboy_moore

Newcomer
Joined
Feb 3, 2004
Messages
6
i have a function that binds data to a listbox using a dataview ( using a dataset filled by an external xml file)
however when i try to sort using the "orderNo" field it sorts it in a very odd way...ie:

1
11
12
13
14
2
3
4
5
6
7
.....etc

does anybody know how to order these numerically (i really do need to keep this in a dataview)

Cheers
 
Same Topic, New Question

I'm actually having a very similar problem, from a different set of circumstances.

I'm filling in a dataview from a sql statement, and adding in calculated fields using the dataview.AddNew() method. After all the rows are in the dataview, I set the Sort property.

Originally I set it to use the "sort" column that I had created to have the report display properly. It was showing up as follows:
1, 2, 3, 5, 6, 7, 8, 9, 10, 11, (ect.), 4

I found it kind of odd so I tried different kinds of sorts, descending, switching to other columns for the sort (both alpha and numeric) but the one row always stays in the last position when I bind the dataview to the datagrid.

Has anyone else encountered something similar to this? Or have any hints/suggestions on how to get the last row in the dataview sorting with the rest of them? :)

Thanks,
V

*edit*
I have since detirmined that the row in question is the last row that is inserted using the dataview.AddNew() method. I'm not sure what exactly that would do to cause a difference though.
 
Last edited:
Just in case anyone else runs into this issue, I thought I'd post my work around to the issue and close out the question.

Whatever the cause is (It may be something I unwittingly did incorrectly with the dataview...) in this case, whichever row is added last will not sort. When I add an entirely blank row to the dataview, that row becomes the "non-sorting" one. If that row is then immediatly deleted, all the rows in the view sort properly.

It's an ugly work around in my opinion, but I couldn't find another way.
 
Back
Top