选择 RadComboBox 中的第一项
我试图让 RadComboBox 选择结果集中的第一项,但未能做到这一点。我问过 Telerik 的人,他们也无法让它工作。我有一个演示项目可供下载:
https://rcpt.yousendit.com/1110087085/647dc0d8e5ed4f6763d1ab5e270f 8c6b
如果我在输入字段中输入“purchas”,我希望突出显示“purchasability”,因为它是结果集中的第一项。我想要发生的下一件事是按 [enter] 键以引起回发。由于应选择“可购买性”,因此 RadComboBox1.SelectedValue 应为 405,该值在回发后显示在标签中。请注意,这些操作都不涉及使用鼠标在结果集中选择项目。
I'm trying to get a RadComboBox to select the first item in a result set but have not been able to do so. I have asked the Telerik folks and they can't get it to work either. I have a demo project available for download here:
https://rcpt.yousendit.com/1110087085/647dc0d8e5ed4f6763d1ab5e270f8c6b
If I type 'purchas' in the input field, I want 'purchasability' to be highlighted since it's the first item in the result set. The next thing I want to have happen is to press the [enter] key in order cause a postback. Since 'purchasability' should be selected, the RadComboBox1.SelectedValue should be 405, which is displayed in a label after the postback. Please note that none of these operations involve using the mouse to select an item in the result set.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简而言之,当您添加 EmptyMessage 时,组合框默认情况下不会选择第一项。
Simply, when you add EmptyMessage the combo box will not select the first item by default.
老实说,我不明白您希望如何在场景中使用按钮单击服务器处理程序输出组合框中的选定值。获取面板内按钮的客户端实例并调用其 click() 方法,或者为组合设置 AutoPostBack = true 并连接其 SelectedIndexChanged 事件以修改标签文本。对于后者,我不确定这将如何与组合框的 Web 服务的客户端按需加载一起使用。
Honestly I do not see how you expect to output the selected value in the combobox using the button click server handler in your scenario. Either get the client instance of the button inside the panel and invoke its click() method or set AutoPostBack = true for the combo and wire its SelectedIndexChanged event to modify the label text. For the latter and I am not sure how this will work with client load-on-demand with web service for the combobox.