Пример #1
0
        public static void ys_Company_GridLookUpEdit(DevExpress.XtraEditors.GridLookUpEdit Control)
        {
            #region 列名
            DevExpress.XtraGrid.Columns.GridColumn ID = new DevExpress.XtraGrid.Columns.GridColumn();
            ID.Name         = "Id";
            ID.Visible      = true;
            ID.FieldName    = "Id";
            ID.Caption      = "编号";
            ID.VisibleIndex = -1;

            DevExpress.XtraGrid.Columns.GridColumn Name = new DevExpress.XtraGrid.Columns.GridColumn();
            Name.Name         = "CompanyName";
            Name.FieldName    = "CompanyName";
            Name.Caption      = "名称";
            Name.VisibleIndex = 0;
            Name.Width        = 160;
            Name.Visible      = true;

            DevExpress.XtraGrid.Columns.GridColumn code = new DevExpress.XtraGrid.Columns.GridColumn();
            code.Name         = "Contact";
            code.FieldName    = "Contact";
            code.Caption      = "联系人";
            code.VisibleIndex = 1;
            code.Width        = 60;
            code.Visible      = true;

            Control.Properties.PopupView.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] { ID, Name, code });

            #endregion
            Control.Properties.ImmediatePopup = true;
            Control.Properties.NullText       = "";
            Control.Properties.TextEditStyle  = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
            Control.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
            Control.Properties.DisplayMember  = "CompanyName";
            Control.Properties.ValueMember    = "Id";
            Control.Properties.View.OptionsView.ColumnAutoWidth = false;
            Control.Properties.DataSource = InitalControlHelper.GetAllCompany();
        }