• DevExpress控件 LookupEdit 模糊查询


    LookupEdit 的具体设置

     //单击回车按钮跳转下一个控件
     this.lookUpEdit1.EnterMoveNextControl = true; 
    
     //添加一个按钮,类型选择Delete,用来删除选中项
     this.lookUpEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo), new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Delete, "删除", -1, true, true, false, DevExpress.XtraEditors.ImageLocation.MiddleCenter, null, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.Delete), serializableAppearanceObject1, "删除选中项", "Delete", null, true)});
    
     //在输入框按任一可见字符键时立即弹出下拉窗体
     this.lookUpEdit1.Properties.ImmediatePopup = true; 
    
     this.lookUpEdit1.Properties.NullText = "[请输入……]";
    
     //不用显示表头
     this.lookUpEdit1.Properties.ShowHeader = false; 
    
     //允许选择编辑
     this.lookUpEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; 
    
     this.lookUpEdit1.Properties.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(this.lookUpEdit1_Properties_ButtonClick);
    
    下面是Delete按钮的事件,设置LookupEdit的EditValue为null就可以清除选中的数据

            private void lookUpEdit1_Properties_ButtonClick(object sender, ButtonPressedEventArgs e)
            {
                if (e.Button.Kind== ButtonPredefines.Delete)
                    lookUpCompanyName.EditValue = null;
            }
    最后给lookUpEdit1的数据源Properties.DataSource 赋值就行了。


  • 相关阅读:
    VS远程调试亲历
    IIS7.5 配置虚拟目录的经历
    IE 兼容一问题一小记
    寻找 IBatisNet 批量插入(批量复制) 的心路历程
    Linq 多连接及 left join 实例 记录
    easyui treegrid idField 所在属性中值有花括号(如Guid)当有鼠标事件时会报错,行记录一下
    HDU1754
    HDU1166
    线段树模板
    HDU1599(Floyd最小环)
  • 原文地址:https://www.cnblogs.com/rsls/p/4364107.html
Copyright © 2020-2023  润新知