开发者

How to clear items in DevExpress LookupEdit

开发者 https://www.devze.com 2023-01-14 04:27 出处:网络
Hai, Am using DevExpress LookupEdit in C#.NET application.I want to clear all items in the LookupEdit.Please help

Hai, Am using DevExpress LookupEdit in C#.NET application.I want to clear all items in the LookupEdit.Please help

code:

lkpLabItem.Properties.DataSource = null; 
         lkpLabItem .Properties.DataSource = _lab.selectChemicals ();
         lkpLabItem.Properties.DisplayMember = "labitem_Name";
         lkpLabItem.Properties.ValueMember = "labItem_ID";
         lkpLabItem.Properties.BestFitMode = BestFitMode.BestFit;
         lkpLabItem.Properties.SearchMode = SearchMode.AutoComplete;

         lkpLabItem.Properties.Columns.Add(new LookUpColumnInfo("labitem_Name", 100, "La开发者_运维技巧b Items"));
         lkpLabItem.Properties.AutoSearchColumnIndex = 1;

Thank you.

How to clear items in DevExpress LookupEdit


LookupEdit is mean to provide list of data from the linked datasource, so, to clear the items you can set its DataSource property to null:

lookUpEdit1.Properties.DataSource = null;

or, if you are using a BindingSource as the LookupEdit data source, you can set its DataSource property to null.


Got items correctly.

problem is that am creating `LookUpColumnInfo whenever am calling same method. code:

lkpLabItem.Properties.DataSource = null; 
         lkpLabItem .Properties.DataSource = _lab.selectChemicals ();
         lkpLabItem.Properties.DisplayMember = "labitem_Name";
         lkpLabItem.Properties.ValueMember = "labItem_ID";
         lkpLabItem.Properties.BestFitMode = BestFitMode.BestFit;
         lkpLabItem.Properties.SearchMode = SearchMode.AutoComplete;

create LookUpColumnInfo only first time then call method without LookUpColumnInfo

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号