Dev LookUpEdit下拉框控件

今天做dev的项目的时候,用到了下拉框控件LookUpEdit控件,但是其中有些表示自己忘了。记录一下,不至于以后不用忘了查询费时间。

//使用LookUpEdit的值
变量=this.lookupedit.editvalue.tostring()  //是lookupedit.properties.valuemember的值
变量=this.lookupedit.text.trim()      //是lookupedit.properties.displaymember 的值

lookupedit.itemindex=0;   //选择第一项,0是索引

comb_xq.Properties.NullText = "全部";   //为null时的text值

lookupedit绑定:可以手动绑定也可以根据查询到的list来绑定;

        
    public class ComboxCommon
    {
        public long ID { get; set; }
        public string Name { get; set; }
    }


        /// <summary>
        /// 卡类型下拉框
        /// </summary>
        private void bindcombPrice()
        {
            IList<ComboxCommon> infoList = new List<ComboxCommon>();
            ComboxCommon info1 = new ComboxCommon();
            info1.Name = "类型1";
            info1.ID = 0;
            infoList.Add(info1);
            ComboxCommon info2 = new ComboxCommon();
            info2.Name = "类型2";
            info2.ID = 1;
            infoList.Add(info2);
            lookupedit.Properties.DataSource = infoList;
            lookupedit.Properties.ValueMember = "ID";
            lookupedit.Properties.DisplayMember = "Name";
            comb_Price.ItemIndex = 0;
        }


//list数据绑定
for (int i = 0; i < list.Count; i++)
            {
                ComboxStreetInfo info1 = new ComboxStreetInfo();
                info1.Name = list[i].Name;
                info1.ID = list[i].ID;
                infoList.Add(info1);
            }
            lookupedit.Properties.DataSource = infoList;
            lookupedit.Properties.ValueMember = "ID";
            comb_Street.Properties.DisplayMember = "Name";

 

posted @ 2019-07-09 15:08  走过不远的地方  阅读(2041)  评论(0编辑  收藏  举报