Reputation: 4372
I used this piece of code to sort my grid by gender then age, but it is not working:
this.gridCustomers.Columns["GenderCol"].SortOrder = RadSortOrder.Ascending;
this.gridCustomers.Columns["AgeCol"].SortOrder = RadSortOrder.Descending;
If I try to do sorting using Shift key for multi sort, it will work. But I need to do it programmatically.
Upvotes: 0
Views: 657
Reputation: 1070
What about using a SortDescriptor?
SortDescriptor descriptorShipName = new SortDescriptor();
descriptorShipName.PropertyName = "GenderCol";
descriptorShipName.Direction = ListSortDirection.Ascending;
SortDescriptor descriptorFreight = new SortDescriptor();
descriptorFreight.PropertyName = "AgeCol";
descriptorFreight.Direction = ListSortDirection.Descending;
this.radGridView1.SortDescriptors.Add(descriptorShipName);
this.radGridView1.SortDescriptors.Add(descriptorFreight);
For more information about sorting RadGridView: http://docs.telerik.com/devtools/winforms/gridview/sorting/setting-sorting-programmatically
Upvotes: 1