RadGrid多列排序不工作

本文关键字:工作 排序 RadGrid | 更新日期: 2023-09-27 18:14:16

我使用这段代码按性别和年龄对我的网格进行排序,但它不起作用:

        this.gridCustomers.Columns["GenderCol"].SortOrder = RadSortOrder.Ascending;
        this.gridCustomers.Columns["AgeCol"].SortOrder = RadSortOrder.Descending;

如果我尝试使用Shift键进行多排序排序,它将工作。但是我需要通过编程来实现

RadGrid多列排序不工作

如何使用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);

有关RadGridView排序的更多信息:http://docs.telerik.com/devtools/winforms/gridview/sorting/setting-sorting-programmatically