combobox(ajaxcontroltoolkit)的text属性不清楚。 [英] Text property of combobox (of ajaxcontroltoolkit) don't be clear.

查看:85
本文介绍了combobox(ajaxcontroltoolkit)的text属性不清楚。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



i从ajaxcontroltoolkit用于组合框。

用于搜索有时我需要清除我的组合框的文本属性,直到搜索方法返回所有记录(没有过滤器)

但命令(mycombobox.text =)不起作用。为什么?



谢谢



我的尝试:



i无法做任何事情...



help

解决方案

AjaxControlToolkit ComboBox 的行为与标准的ASP.NET DropDownList 控件类似,所以从技术上讲,你无法使用 .Text 属性清除文本通常使用标准 TextBox 控件的操作。 />


您可以做的是在 Page_Load <上向 ComboBox 中插入一个空值/ code>事件:



 ComboBox1.Items.Insert( 0 ,New ListItem( ))





现在,这将在 ComboBox 列表中放置一个空字符串。然后你可以打电话:



 ComboBox1.ClearSelection(); 





SelectedIndex 重置为默认项目,或者如果你想要这样的话,你可以删除空值:



 ComboBox1.Items.Remove(  ); 


Hello

i use from ajaxcontroltoolkit for a combobox.
for search sometimes i nead to cleat text property of my combobox until search method return all record (without filter)
but the command (mycombobox.text = "") dont work. why?

Thanks

What I have tried:

i could't do any things...

help

解决方案

The AjaxControlToolkit ComboBox behaves similarly as the standard ASP.NET DropDownList control, so technically, you can't clear the text just what you normally do with the standard TextBox control using the .Text property.

What you can do is insert an empty value to your ComboBox like this on Page_Load event:

ComboBox1.Items.Insert(0, New ListItem(""))



Now, this will put an empty string in your ComboBox list. You can then call:

ComboBox1.ClearSelection();



to reset the SelectedIndex to the default item or you could remove the empty value if you'd like something like:

ComboBox1.Items.Remove("");


这篇关于combobox(ajaxcontroltoolkit)的text属性不清楚。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆