GridView and multiple column sorting: is this a bug?

E

Eric

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?
 
B

Brock Allen

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top