PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Can't get DataView to sort correctly.

Reply

Can't get DataView to sort correctly.

 
Thread Tools Rate Thread
Old 16-06-2006, 05:23 PM   #1
tshad
Guest
 
Posts: n/a
Default Can't get DataView to sort correctly.


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


  Reply With Quote
Old 16-06-2006, 06:00 PM   #2
Scott M.
Guest
 
Posts: n/a
Default Re: Can't get DataView to sort correctly.

What happens if you just try this:

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


"tshad" <tscheiderich@ftsolutions.com> wrote in message
news:uGT9GFWkGHA.3536@TK2MSFTNGP05.phx.gbl...
>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
>
>



  Reply With Quote
Old 16-06-2006, 07:52 PM   #3
tshad
Guest
 
Posts: n/a
Default Re: Can't get DataView to sort correctly.

"Scott M." <s-mar@nospam.nospam> wrote in message
news:OWjiAYWkGHA.5020@TK2MSFTNGP02.phx.gbl...
> 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" <tscheiderich@ftsolutions.com> wrote in message
> news:uGT9GFWkGHA.3536@TK2MSFTNGP05.phx.gbl...
>>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
>>
>>

>
>



  Reply With Quote
Old 17-06-2006, 07:19 AM   #4
Cor Ligthert [MVP]
Guest
 
Posts: n/a
Default Re: Can't get DataView to sort correctly.

Tshad,

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

Cor


"tshad" <tscheiderich@ftsolutions.com> schreef in bericht
news:eBnGPYXkGHA.3572@TK2MSFTNGP04.phx.gbl...
> "Scott M." <s-mar@nospam.nospam> wrote in message
> news:OWjiAYWkGHA.5020@TK2MSFTNGP02.phx.gbl...
>> 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" <tscheiderich@ftsolutions.com> wrote in message
>> news:uGT9GFWkGHA.3536@TK2MSFTNGP05.phx.gbl...
>>>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
>>>
>>>

>>
>>

>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off