zoukankan      html  css  js  c++  java
  • C# devExpress GridControl 行中行 子行 多级行

    在工作中经常会碰到需要做行中行,多级行的情况,不熟的情况下,我也只能试着实现.


    命名空间

    using DevExpress.XtraEditors.Repository;
    using System.Data.SqlClient;
    

    实现代码

    一下实现的也只是一个demo,大家不要拘泥于数据

       DB db = new DB();
                DataSet ds = new System.Data.DataSet();
                SqlCommand comm2 = new SqlCommand(sql, db.getSqlConnection());  //db.getSqlConnection() 返回一个sqlConnection 对象
                SqlCommand comm3 = new SqlCommand(sql1, db.getSqlConnection());
                SqlCommand comm4 = new SqlCommand(sql2, db.getSqlConnection());
                SqlDataAdapter da2 = new SqlDataAdapter(comm2);
                SqlDataAdapter da3 = new SqlDataAdapter(comm3);
                SqlDataAdapter da4 = new SqlDataAdapter(comm3);
    
                da2.Fill(ds,"emp");
                da3.Fill(ds,"job");
                da4.Fill(ds,"re");
    
                this.treeListLookUpEdit1TreeList.DataSource = ds;
    
                DataColumn parentColumn = ds.Tables["emp"].Columns["empNum"];
                DataColumn childColumn = ds.Tables["job"].Columns["empNum"];
                DataColumn secondChild = ds.Tables["re"].Columns["empNum"];
    
                DataRelation relCustOrder;
                relCustOrder = new DataRelation("对应工作", parentColumn, childColumn);
                DataRelation job;
                job = new DataRelation("部门调整", childColumn, secondChild);
                ds.Relations.Add(relCustOrder);
                ds.Relations.Add(job);
                this.gridControl1.DataSource = ds.Tables["emp"];
    
    
    实现效果如下:


  • 相关阅读:
    在am中定义消息集束,并在CO中验证之后抛出异常。
    在EORow或者VORow中对数据进行重复性校验
    axis2 webservice jar包使用情况(转)
    std::function以及std::bind
    Qt学习过程
    NULL和nullptr
    清空表且id为0
    C++线程互斥、同步
    warning: deleting 'void *' is undefined 错误
    Classification / Recognition
  • 原文地址:https://www.cnblogs.com/xiaxiaolu/p/4367154.html
Copyright © 2011-2022 走看看