zoukankan      html  css  js  c++  java
  • DevExpress中GridColumnCollection实现父子表数据绑定

    绑定数据:

    父表:

     DataTable _parent = _dvFlt.ToTable().Copy();
    

      子表:

     DataTable _child = _dvLog.ToTable().Copy();
    

      关联:

    DataSet _ds = new DataSet();
                    _ds.Tables.Add(_parent);
                    _ds.Tables.Add(_child);
    
                    DataRelation _dr = new DataRelation("", _ds.Tables[0].Columns["flight_id"], _ds.Tables[1].Columns["ref_keys"], false);
                    _ds.Relations.Add(_dr);
    
                    dgInfo.DataSource = _ds.Tables[0];
    

      主表加载事件:

    private void dgInfo_DataSourceChanged(object sender, EventArgs e)
            {
    
                    GridColumnCollection gridColumns = this.gridView1.Columns;
    foreach (GridColumn item in gridColumns)
    {
    
    }
    }
    

      子表加载事件:

     private void GridView1_MasterRowExpanded(object sender, DevExpress.XtraGrid.Views.Grid.CustomMasterRowEventArgs e)
            {
                GridView detailView = gridView1.GetDetailView(e.RowHandle, e.RelationIndex) as DevExpress.XtraGrid.Views.Grid.GridView;
                detailView.CustomColumnDisplayText += DetailView_CustomColumnDisplayText;
                GridColumnCollection gridColumns = detailView.Columns;
                foreach (GridColumn item in gridColumns)
    {
    }
    }
    

      改变事件格式:

    item.DisplayFormat.FormatString = "MM-dd";
                                item.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom;
    

      

  • 相关阅读:
    HDinsight 系列-使用证书登陆中国区Azure
    PowerBI 应用时间智能(生成日期表)
    Hadoop 常用命令之 HDFS命令
    Hadoop分布式集群安装
    DAX:New and returning customers
    Hadoop 安装过程中出现的问题
    ftp 报错 200 Type set to A
    LC.exe 已退出,代码为-1 问题解决
    C# 文件操作
    EfRepository
  • 原文地址:https://www.cnblogs.com/sunliyuan/p/11580064.html
Copyright © 2011-2022 走看看