Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > GridView and multiple column sorting: is this a bug?

Reply
Thread Tools

GridView and multiple column sorting: is this a bug?

 
 
Eric
Guest
Posts: n/a
 
      06-06-2006
I have a GridView control that I want to sort on multiple columns when I
click a particular column. For example, I display Last name + ", " + First
name in the first column and display id in the second column. When clicking
on the first column, I want the GridView to sort on LastName and FirstName.
Based on Microsoft's documentation of SortExpression property, all I have to
do is to set SortExpression=LastName,FirstName on the first column. But when
the GridView sorts the data, it only applies sorting direction to the second
parameter of the SortExpression. In the above example, if I click on the
first column, the GridView apparently always does sorting by LastName in
ascending order, but the FirstName sort can be either ascending or
descending (depending on whether I clicked the first column once or twice).
I would expect the GridView to sort the entire sort expression on
ascending/descending order, but it looks like the GridView does this only
for the last parameter in the sort expression. Is this a bug or what?


 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      06-07-2006
If your data is a DataSet, DataTable or DataView, all that the grid is doing
is passing in your SortExpression into the DataView's Sort property and it
appends " DESC" when descending is requested.

-Brock
http://staff.develop.com/ballen


> I have a GridView control that I want to sort on multiple columns when
> I click a particular column. For example, I display Last name + ", " +
> First name in the first column and display id in the second column.
> When clicking on the first column, I want the GridView to sort on
> LastName and FirstName. Based on Microsoft's documentation of
> SortExpression property, all I have to do is to set
> SortExpression=LastName,FirstName on the first column. But when the
> GridView sorts the data, it only applies sorting direction to the
> second parameter of the SortExpression. In the above example, if I
> click on the first column, the GridView apparently always does sorting
> by LastName in ascending order, but the FirstName sort can be either
> ascending or descending (depending on whether I clicked the first
> column once or twice). I would expect the GridView to sort the entire
> sort expression on ascending/descending order, but it looks like the
> GridView does this only for the last parameter in the sort expression.
> Is this a bug or what?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pump data by row and column to dynamic created column in gridview johnsonlim026 ASP .Net 0 02-27-2010 05:29 PM
gridview column values to another page via gridview hyperlink column Keith G Hicks ASP .Net 3 02-18-2008 06:17 AM
1 Gridview. Dropdown A is column from database, Dropdown B is column from database, Data in A and B must be from same row. anonymoushamster@gmail.com ASP .Net 2 11-07-2007 12:40 PM
GridView - Setting the text of the 'select' column to the value of another column Greg Smith ASP .Net 0 04-12-2007 03:11 PM
How to hide a GridView column when the column's Visible property does not support databinding? Keithb ASP .Net 2 10-27-2006 05:02 AM



Advertisments