富贵资源网 Design By www.hznty.com

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查找分组 ,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com