[DevExpress]控件之GridLookupedit的运用

代码:

        #region 内部主题绑定
        private void gridLookupeditBind() 
        {
            DataTable dt = new DataTable();
            string strSql = "SELECT [ID],[subject],[htmlURL] FROM [OA].[dbo].[OA_SubjectQuery]";
            dt = DbHelperSQL.Query(strSql).Tables[0];

            try 
            {
                this.gloksubject.Properties.DataSource = dt;
                this.gloksubject.Properties.DisplayMember = dt.Columns[1].ColumnName;
                this.gloksubject.Properties.ValueMember = dt.Columns[2].ColumnName;

                this.gloksubject.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
                this.gloksubject.Properties.View.BestFitColumns();
                this.gloksubject.Properties.ShowFooter = false;
                this.gloksubject.Properties.View.OptionsView.ShowAutoFilterRow = true; //显示不显示grid上第一个空行,也是用于检索的应用
                this.gloksubject.Properties.AutoComplete = false;
                this.gloksubject.Properties.ImmediatePopup = true;
                this.gloksubject.Properties.PopupFilterMode = DevExpress.XtraEditors.PopupFilterMode.Contains;
                this.gloksubject.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;

                
            } 
            catch(Exception ex)
            {
                XtraMessageBox.Show(ex.ToString(), "警告");
            }

       
        }
        #endregion
效果:

[DevExpress]控件之GridLookupedit的运用_第1张图片

你可能感兴趣的:([DevExpress]控件之GridLookupedit的运用)