Devexpress中Gridcontrol查找分组
程序员文章站
2022-04-24 07:54:16
1 private void button1_Click(object sender, EventArgs e) 2 { 3 DataTable dt = new DataTable(); 4 dt.Columns.Add("Group"); 5 dt.Columns.Add("id... ......
devexpress中gridcontrol查找分组 ,具体代码如下所述:
private void button1_click(object sender, eventargs e) { datatable dt = new datatable(); dt.columns.add("group"); dt.columns.add("idex"); dt.columns.add("name"); for (int i = 0; i < 5; i++) { datarow dr = dt.newrow(); dr["group"] = "<5"; dr["idex"] = i.tostring(); dr["name"] = "姓名" + i.tostring(); dt.rows.add(dr); } for (int i = 5; i <= 10; i++) { datarow dr = dt.newrow(); dr["group"] = "(5,10]"; dr["idex"] = i.tostring(); dr["name"] = "姓名" + i.tostring(); dt.rows.add(dr); } for (int i = 10; i <= 15; i++) { datarow dr = dt.newrow(); dr["group"] = "(10,15]"; dr["idex"] = i.tostring(); dr["name"] = "姓名" + i.tostring(); dt.rows.add(dr); } gridcolumnnumber.fieldname = "idex"; gridcolumnname.fieldname = "name"; gridcolumngroup.fieldname = "group"; gridcolumngroup.groupindex = 0; gdc.datasource = dt; gdv.expandallgroups(); for (int i = -1; gdv.isgrouprow(i); i--) { datarow dr = gdv.getdatarow(gdv.getdatarowhandlebygrouprowhandle(i)); if (dr == null) return; if (dr["group"].tostring() == "(5,10]") { gdv.collapseallgroups(); gdv.focusedrowhandle = i; gdv.setrowexpanded(i, true); return; } } }
总结
以上所述是小编给的大家介绍的devexpress中gridcontrol查找分组 ,希望对大家有所帮助
上一篇: 论美颜自拍就真没输过谁 美图T8评测
推荐阅读
-
DevExpress实现自定义GridControl中按钮文字内容的方法
-
DevExpress实现GridControl同步列头checkbox与列中checkbox状态
-
DevExpress中GridControl列转义的实现方法
-
Devexpress中Gridcontrol查找分组
-
通过DevExpress GridControl中的Format Rules来控制网格样式
-
DevExpress中获取GridControl排序之后的List
-
DevExpress中获取GridControl排序之后的List
-
WPF 中DevExpress14.2 GridControl控件的使用
-
WPF在Devexpress的gridcontrol中ComboBox绑定数据
-
Devexpress中Gridcontrol查找分组