在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
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查找分组 ,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的! |
请发表评论