做出选择后创建动态下拉列表
我正在尝试在选择下拉列表后创建动态下拉列表(在 asp.net vb 中)
例如:我有一个下拉问题,询问:您开什么品牌的汽车(丰田、福特、本田、日产、雪佛兰)
选择品牌后,我希望在其下方显示另一个下拉列表,并提供新的选择
例如:如果选择 Nissan,第二个下拉列表将(从数据库)填充为(Altima、Maxima 等...)
并且在在某些情况下,我希望出现一个文本框,但如果我能找出下拉部分,我确信我能找出文本框。
提前致谢。
I am trying to create a dynamic dropdown after a dropdown has been selested (in asp.net vb)
For example: I have a dropdown question that asks: What brand of car do you drive (Toyota, Ford, Honda, Nissan, Chevrolet)
When the brand is selected I want another dropdown to appear under it with new chocies
For example: If Nissan is chosen, the second dropdown will be populated (from the database) with (Altima, Maxima, etc...)
And in some cases I would like a text box to appear, but If I can figure out the dropdown portion, I am sure I can figure out the textbox.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
按照评论中的建议,我将其作为答案
如果您使用 Ajax,则可以使用 AjaxControlToolkit 的 CascadingDropdownExtender。
这是它的直接链接:
http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx
这是一个视频教程:http://www.asp .net/ajax/videos/how-do-i-use-the-aspnet-ajax-cascadingdropdown-control-extender
As suggested in the comments, i'm putting this in as an answer
If you are using Ajax, you could use the AjaxControlToolkit's CascadingDropdownExtender.
Here is the direct link to it:
http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx
And here is a Video-Tutorial: http://www.asp.net/ajax/videos/how-do-i-use-the-aspnet-ajax-cascadingdropdown-control-extender
像这样?
http://www.codeproject.com/KB/custom-controls/ajaxdropdownlist.aspx
如果你在 Google 上搜索一下,就会发现很多例子。
http://www.google.com/search?q=ajax%20dropdownlist
Like this?
http://www.codeproject.com/KB/custom-controls/ajaxdropdownlist.aspx
There are quite a few examples if you look on Google.
http://www.google.com/search?q=ajax%20dropdownlist
在DropDownList选中索引改变事件中,你可以做任何你想做的事情。您可以显示其他 DropDownList 或其他 TextBox,还可以将 DropDownList 与您想要的项目绑定。
您的代码可能如下所示:
In the DropDownList selected index changed event, you can do whatever you want. You can show the other DropDownList or the other TextBox and you can also bind the DropDownList with the items you want.
Your code could look like: