PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Can't get DataView to sort correctly.
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Can't get DataView to sort correctly.
![]() |
Can't get DataView to sort correctly. |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
"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 >> >> > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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 >>> >>> >> >> > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

