Can't get DataView to sort correctly.

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I do a select into a Dataset, apply a DataView to it and then sort it. But
the sort is not correct. I am sorting it by the UserName and it is not in
alpha order when I bind it to my datagrid.

When the filter and sort look like:
dv.RowFilter: ActionType = 1
dv.Sort = UserFullName asc,SessionID,CreateDate
HistoryLogGrid.DataSource = dv
HistoryLogGrid.DataBind()

I get the following rows:

Joe
Joseph
Robert
Jose
Debbie
Joe
Ana
Ana
Brian
Boz
Charlie
....

Notice how the first few rows are not sorted then they are.

If I reverse the sort so that I have the following for the filter and sort
and databind:
dv.RowFilter: ActionType = 1
dv.Sort = UserFullName desc,SessionID,CreateDate
HistoryLogGrid.DataSource = dv
HistoryLogGrid.DataBind()

I get the following:

....
Charlie
Boz
Brian
Ana
Ana
Joe
Joseph
Robert
Jose
Debbie
Joe

You can see the order has change except for the few that were not sorted in
the first example. And they are in the same order as the first example.

Why is this???

Am I missing something?

Thanks,

Tom
 
What happens if you just try this:

dv.Sort = UserFullName
HistoryLogGrid.DataSource = dv
HistoryLogGrid.DataBind()
 
Scott M. said:
What happens if you just try this:

dv.Sort = UserFullName
HistoryLogGrid.DataSource = dv
HistoryLogGrid.DataBind()

Found the problem.

It had to do with a couple of nulls that were in my sort column and my page
adding the names from another column so it looked like there was something
in the column when there wasn't.

Thanks,

Tom
 
Tshad,

I had the same idea, because you are showing Firstnames and was sorting
FullNames.
:-)

Cor
 
Back
Top