[英]devexpress textedit/mru autocomplete?
is it possible to set devexpress
textedit
to get data from the database and make it autocomplete?是否可以设置
devexpress
textedit
从数据库中获取数据并使其自动完成? or is there any tool in devexpress
to do it?还是
devexpress
中有任何工具可以做到这一点?
here is my code这是我的代码
string conn = ConfigurationManager.ConnectionStrings["SystemDatabase"].ConnectionString;
SqlConnection sqlconn = new SqlConnection(conn);
SqlCommand mycommand = new SqlCommand("spProduct_Search", sqlconn);
mycommand.CommandType = CommandType.StoredProcedure;
sqlconn.Open();
SqlDataReader sdr = mycommand.ExecuteReader();
AutoCompleteStringCollection autotext = new AutoCompleteStringCollection();
while (sdr.Read())
{
autotext.Add(sdr.GetString(0));
}
txtProductSearch.AutoCompleteMode = AutoCompleteMode.Suggest;**Textbox**
txtProductSearch.AutoCompleteSource = AutoCompleteSource.CustomSource;**Textbox**
txtProductSearch.AutoCompleteCustomSource = autotext;**Textbox**
if possible i want to change textbox
to textedit
a tool from devexpress
but i dont know how to make a textedit
autocomplete.如果可能的话,我想将
textbox
更改为来自textedit
的文本devexpress
工具,但我不知道如何使textedit
编辑自动完成。
I believe what you want is the LookUpEdit control and it's AutoSuggest mode .我相信你想要的是 LookUpEdit 控件和它的AutoSuggest 模式。 Per the documentation, the AutoSuggest mode:
根据文档,AutoSuggest 模式:
When a user types in text, the editor fires the AutoSuggest event (LookUpEdit.AutoSuggest \ GridLookUpEdit.AutoSuggest) that runs a custom asynchronous task (a System.Threading.Tasks.Task object).
当用户键入文本时,编辑器会触发运行自定义异步任务(System.Threading.Tasks.Task 对象)的 AutoSuggest 事件 (LookUpEdit.AutoSuggest \ GridLookUpEdit.AutoSuggest)。 This task performs a search against the given data set, and returns the ICollection object with records that match the entered text.
此任务针对给定数据集执行搜索,并返回 ICollection object 以及与输入文本匹配的记录。 This collection is automatically assigned to the editor's DataSource and its entries appear in the editor drop-down menu.
此集合自动分配给编辑器的 DataSource,并且其条目出现在编辑器下拉菜单中。
During this asynchronous event you could execute your database query and populate the ICollection with your result set.在此异步事件期间,您可以执行数据库查询并使用您的结果集填充 ICollection。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.