DropdownList:SelectIndex = 0 基于用户清除文本框/文本更改。 JavaScript
我有一个场景,其中我有一个带有自动完成扩展器的文本框和两个下拉列表;这使得用户能够搜索产品信息。
理想情况下,我想创建一些有效的东西,“重置”下拉菜单,以便当用户单击文本框时(如果有这样的事情,也许我会“onenter”/“ondelete”)。
我看过 .Attributes.Add 但无法弄清楚。
你如何在这个场景中包含asp.net控件,这样我就可以得到类似的东西:
tbxAutoComplete.Attributes.Add("OnClick", ddlLevelAuto.SelectedIndex = 0, ddlItemCategory.SelectedIndex = 0,);
我显然知道这不起作用,因为我一边把头撞在桌子上:)
任何帮助,感激不尽。
I have a scenario whereby I have a textbox with an autocomplete extender attached and two drop down lists; this enables a user to search for product info.
Ideally I'd like to create something that effectivley, 'resets' the drop downs so that when a user clicks on the textbox (maybe I'll do it 'onenter'/'ondelete' if there is such a thing).
I've had a look at .Attributes.Add but cannae figure it out.
How do you include asp.net controls within this scenario so I could have something along the lines of:
tbxAutoComplete.Attributes.Add("OnClick", ddlLevelAuto.SelectedIndex = 0, ddlItemCategory.SelectedIndex = 0,);
I obviously know this doesn't work as I'm whilst banging my head on my desk : )
Any help, gratefully received.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能使用服务器端代码来重置;您需要客户端 JavaScript 代码来执行此操作。 您可以通过在 javascript 中设置来重置下拉列表
当文本框触发其焦点客户端事件时,
。 HTH。
You can't use server-side code to reset; you need client-side JavaScript code to do this. You can reset a drop down by setting
in javascript, when the textbox fires its focus client-side event.
HTH.