动态显示其他下拉列表框 [英] dynamic display of additional dropdown list boxes

查看:55
本文介绍了动态显示其他下拉列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我访问了一些网站,当用户在下拉列表框中选择一个选项时,它会
自动显示另一个下拉列表框,该框具有与第一个下拉列表中的所选选项相关的选项.请详细说明如何创建此过程.请提出一些选择来做到这一点. jquery或任何脚本或任何可能的方法来执行此操作.

Hi all,
I visited some sites wherein when a user selects an option in a dropdownlist box, it
automatically displays another dropdownlist box which has options relevant to the selected option in 1st dropdownlist. please explain how to create this process in detail. Please suggest some options to do that. either jquery or any scripts or any such possible methods to perform this.

推荐答案

hi
查看以下链接
链接1 [链接2 [链接3 [ link4 [ ^ ]
hi
check out the following links
link1[^]
link2[^]
link3[^]
link4[^]


大家好,
我终于找到了一种使我的需求起作用的方法.
首先,在我们设计的页面中添加所需的下拉框,并在C#page_load方法上,将下拉框的visible属性设置为false.
例如:
Hi all,
I finally found a way to make my requirement work.
First, add the required dropdown boxes in the page we design and on C# page_load method, set the visible attribute of the dropdown boxes as false.
Ex:
protected void Page_Load(object sender, EventArgs e)
    {
presenttype.Visible = false;
}


下一步是设置父下拉框的属性,如下所示.


Next step is to set the parent dropdown box''s attributes as follows.

OnSelectedIndexChanged="sta_Change" AutoPostBack="true"


这里sta_Change是一种方法,其中我们将根据父下拉框中的选定选项编写用于显示隐藏的下拉框的代码,如下所示.


here sta_Change is the method where we are going to write the code for displaying the hidden dropdown boxes based on the selected option in parent dropdown box as follows.

public void sta_Change(object sender, EventArgs e)
    {
        if (parentDropList.SelectedValue == "option")
        {
presenttype.Visible = true;
}
}


就这样.
运行页面时,在父下拉列表中选择值后,由于属性
,它会自动启用子下拉列表


That''s it.
When we run the page, after we select the value in parent dropdownbox, it automatically enables the child dropdownbox due to the attribute

AutoPostBack="true"



感谢所有阅读并回答我的问题的人.我希望所提供的解决方案(对Visual Studio已经可用,但我们中的许多人仍然不知道此功能.)对每个人都有用且简单.



Thanks for all who read and replied my question. I hope the solution( already available in visual studio, but many of us are still unaware about this facility.) provided was useful and simple to everyone.


这篇关于动态显示其他下拉列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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