GridLookUpEdit 简单应用

时间:2023-11-23 16:56:26

GridLookUpEdit 简单应用

在属性列表中 Properties  -> view  即可打开设计器进行编辑

GridLookUpEdit 简单应用

后台代码:

 DataTable dtt = stu.StuGetFind(sxml, 1, 50).Tables[0];
DataView dv = new DataView(dtt);
dtt = dv.ToTable(true, new string[] { "Stu_ID", "Stu_Number", "Stu_Name" });
//绑定
gridlup.Properties.DataSource = dtt;
gridlup.Properties.ValueMember = "Stu_ID";
gridlup.Properties.DisplayMember = "Stu_Name"; this.gridlup.Properties.View.OptionsBehavior.AutoPopulateColumns = false;
//默认值
this.gridlup.Properties.NullText = "------请选择------";
//文本居中对齐
this.gridlup.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
this.gridlup.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
this.gridlup.Properties.View.BestFitColumns(); //显示不显示grid上第一个空行,也是用于检索的应用
this.gridlup.Properties.View.OptionsView.ShowAutoFilterRow = true;
            //以下两行是为了更好的用户体验
this.gridlup.Properties.AutoComplete = false;
this.gridlup.Properties.ImmediatePopup = true;
this.gridlup.Properties.PopupFilterMode = DevExpress.XtraEditors.PopupFilterMode.Contains;
//是否可以输入内容进行检索(还是只能使用选择输入)
this.gridlup.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
//是否显示底部
this.gridlup.Properties.ShowFooter = false;

版权声明:本文为博主原创文章,未经博主允许不得转载。