zoukankan      html  css  js  c++  java
  • DevExpress.XtraEditors.GridLookUpEdit 隐藏列

    第三方控件中,我们经常用GridLookUpEdit来下拉多条数据,有时候需要隐藏某一列,在9.2之前

    Title            this.gle1.Properties.DataSource = dt;
                this.gle1.Properties.ValueMember = "Column1";
                this.gle1.Properties.DisplayMember = "Column2";
                this.gle1.Properties.View.Columns["Column1"].Visible = false;
    这样做,指定列就可以了,但是当控件升级到11.2后,发现Columns里面是没有值的,必须手动赋上列值

    Title            this.gle1.Properties.DataSource = dt;
                this.gle1.Properties.ValueMember = "column1";
                this.gle1.Properties.DisplayMember = "column2";
                string tempStr = string.Empty;  //列名
                this.gle1.Properties.View.Columns.Clear();
                for (int i = 0; i < dt.Columns.Count; i++) {
                    tempStr = dt.Columns[i].ColumnName;
                    DevExpress.XtraGrid.Columns.GridColumn col = this.gle1.Properties.View.Columns.AddField(tempStr);
                    col.VisibleIndex = i;
                    col.Caption = tempStr;

                    if (tempStr.Equals("column1"))
                        col.Visible = false;
                }     

    感觉上这种写法有点丑陋,不知道有没有更好的方法。
  • 相关阅读:
    win8应用的编码UI测试
    什么是Peer Review
    Android开发环境的搭建
    运用int.parse()判断闰年代码实现
    等价类划分方法的应用之EditBox(二)
    等价类划分方法的应用之EditBox
    集成测试
    数据可视化简介
    关于processing
    白盒测试VS黑盒测试
  • 原文地址:https://www.cnblogs.com/hunter98/p/2529892.html
Copyright © 2011-2022 走看看