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

            DevExpress.XtraGrid.Columns.GridColumn StaffCode = new DevExpress.XtraGrid.Columns.GridColumn();
            StaffCode.Name         = "SimpleCode";
            StaffCode.FieldName    = "SimpleCode";
            StaffCode.Caption      = "简码";
            StaffCode.VisibleIndex = 0;
            StaffCode.Width        = 60;
            StaffCode.Visible      = true;


            DevExpress.XtraGrid.Columns.GridColumn Name = new DevExpress.XtraGrid.Columns.GridColumn();
            Name.Name         = "FullName";
            Name.FieldName    = "FullName";
            Name.Caption      = "职员";
            Name.VisibleIndex = 1;
            Name.Visible      = true;


            DevExpress.XtraGrid.Columns.GridColumn DeptNAME = new DevExpress.XtraGrid.Columns.GridColumn();
            DeptNAME.Name         = "DepartmentName";
            DeptNAME.FieldName    = "DepartmentName";
            DeptNAME.VisibleIndex = 2;
            DeptNAME.Caption      = "部门";
            DeptNAME.Visible      = true;

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

            #endregion

            Control.Properties.DisplayMember  = "FullName";
            Control.Properties.ValueMember    = "Id";
            Control.Properties.ImmediatePopup = true;
            Control.Properties.NullText       = "";
            Control.Properties.TextEditStyle  = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
            Control.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
            Control.Properties.View.OptionsView.ColumnAutoWidth = false;
            if (IsBindingData)
            {
                Control.Properties.DataSource = InitalControlHelper.GetAllUser();
            }
        }