DEV LookUpEdit下拉框总结
DEV LookUpEdit下拉框总结
DevExpress.XtraEditors.LookUpEdit
设定Properties中一些重要的属性
ValueMember属性,实际的值
DisplayMember属性,显示的值
NullText属性,默认的属性值,如“请选择”,
ShowFooter属性,设定为false
ShowHeader属性,设定为false
PopupFormMinSize属性,设定弹出的项的宽度
右击控件设定EditComlumns,目的设定那些列显示出来
一些在程序逻辑中写的代码
1 //cmbProvince下拉菜单 2 ProvinceModel bindProvinceModel = new ProvinceModel(); 3 string strBindProvince = Newtonsoft.Json.JsonConvert.SerializeObject(bindProvinceModel); 4 string strResult = WebLockConfig.Instance.webProvince.GetProvinceDS(strBindProvince); 5 DataSet ds = Newtonsoft.Json.JsonConvert.DeserializeObject<DataSet>(strResult); 6 7 DataRow dr = ds.Tables[0].NewRow(); 8 dr["PRO_ID"] = ""; 9 dr["PRO_NAME"] = "请选择"; 10 ds.Tables[0].Rows.InsertAt(dr,0); 11 cmbProvince.SelectedText = "请选择"; 12 cmbProvince.Properties.DataSource = ds.Tables[0]; 13 cmbProvince.Properties.DropDownRows = ds.Tables[0].Rows.Count; 14 15 bindProvinceModel = null; 16 ds = null; 17 dr = null; 18 19 ....... 20 //把窗体上的值设定给Model 21 cityModel.PRO_ID = cmbProvince.EditValue.ToString(); 22 23 24 ...... 25 //设定本窗口的默认输入信息 26 cmbProvince.EditValue = ds.Tables[0].Rows[0]["PRO_ID"].ToString();