This is a migrated thread and some comments may be shown as answers.

Multiple column sort

1 Answer 155 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Cliff
Top achievements
Rank 1
Cliff asked on 23 Nov 2010, 02:34 PM
Hi,

I need to programmatically update the sort order for a gridview, for example if I have a list of orders from different companies, in different countries for different amounts, and the user clicks on the country column to sort, I want to add the company and value columns to the sort so that within each country the orders are sorted by company, and within a company the orders are sorted by amount.

I have tried to add these as SortDescriptors in the 'Sorting' event but I cannot get the sort to use the newly added descriptors.

What technique should I be using?

Thanks,

1 Answer, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 23 Nov 2010, 04:17 PM
Hello Cliff,

 You need to cancel the Sorting event (e.Cancel = true), otherwise RadGridView proceeds with its own sorting logic, which clears the previous SortDescriptors, unless the user initiated multiple column sorting (holding down the Shift key while clicking the column header to sort).

Best wishes,
Yavor Georgiev
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
GridView
Asked by
Cliff
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Share this question
or