radgridview如何排序

| 我有一个radgridview ... 我想根据用户单击按钮的升序/降序对它们进行排序。 我也有一个组合框,其中包含radgridview中的列名称,用户可以选择该组合框根据列名称对数据进行排序... 不幸的是,我不知道该怎么做... 你能帮这个忙吗? 谢谢 :)     
已邀请:
这是我的代码,用于对ID进行升序排序: 在gridview中,列为ID,名称,单价和日期... 希望用户选择要排序的特定列。 我有一个组合框,允许用户选择一列 但我无法获取所选组合框项目的值
private void SortAsc_Click(object sender, System.Windows.RoutedEventArgs e)
{
RadGridView1.SortDescriptors.Add(new SortDescriptor()
{
Member =\"ID\",
SortDirection = System.ComponentModel.ListSortDirection.Ascending
}
}
    
我已经解决了这个问题... 我添加了一个组合框,用户可以在其中选择要排序的字段。 这是我的代码:   私有无效SortAsc_Click(对象发送者,System.Windows.RoutedEventArgs e) {     RadComboBoxItem comboItem = combobox1.SelectedItem作为RadComboBoxItem;     字符串selectedItem = comboItem.Content.ToString();     RadGridView1.SortDescriptors.Add(new SortDescriptor()     {         成员= selectedItem,         SortDirection = System.ComponentModel.ListSortDirection.Ascending     }); } 这将以升序排列。要以降序排序,只需将Ascending替换为Descending。 :)     
Telerik的网站非常清晰,并详细介绍了如何对RadGridView进行排序:http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/sorting/defaultcs.aspx 到目前为止您尝试了什么?     

要回复问题请先登录注册