如何在C#中的(datagrid)中对数据进行排序? [英] How to sort the data in (datagrid ) in C# ?
本文介绍了如何在C#中的(datagrid)中对数据进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
It is my code
this.dataGrid1.Allowsort (this .dataGridTextBoxColumn1,ListSortDirection.Descending );
我尝试过:
this.dataGrid1.Allowsort(此.dataGridTextBoxColumn1,ListSortDirection.Descending );
What I have tried:
this.dataGrid1.Allowsort (this .dataGridTextBoxColumn1,ListSortDirection.Descending );
推荐答案
你应该将ColumnSortMode
设置为Programmatic
如下面的代码片段
You should set ColumnSortMode
toProgrammatic
like in snippet below
dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.Programmatic;
这篇关于如何在C#中的(datagrid)中对数据进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文