Devexpress中Gridcontrol查找分组

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查找分组

总结

以上所述是小编给的大家介绍的Devexpress中Gridcontrol查找分组 ,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdsxfd.html