关于下拉列表!! [英] About drop down list!!

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

问题描述

我有一个需要两个下拉列表的应用程序.一个下拉列表包含item("Animal","Vehicle"),另一个下拉列表包含item("cat","car").第二个下拉列表是不可见且不包含项目,但如果我从下拉列表1中选择动物",则它可见并显示项目猫".

i have an application that needs two drop down list .one dropdown list contain item("Animal","Vehicle")and another dropdown list contains item ("cat","car").The second drop down list is invisible and doesn''t contain item but if i select "animal" from dropdown list1 then it visible and show an item "cat".

推荐答案

关于级联下拉列表,然后检查这些

在级联下拉列表中动态选择值 [ ^ ]
如何使用另一个ddl填充下拉列表 [ ^ ]
层叠下拉菜单-国家/地区 [ ^ ]

ASP.NET级联下拉列表(CSASPNETCascadingDropDownList) [ CascadingDropDown演示 [在ASP.NET MVC中级联DropDownList [在ASP.Net中创建级联DropDownList [将CascadingDropDown与数据库一起使用 [
If you are talking about cascading dropdownlist then check these

Selecting value in cascading dropdown list dynamically[^]
How to populate a dropdown list with another ddl[^]
Cascading DropDown - Country to state[^]

ASP.NET cascading drop-down-list (CSASPNETCascadingDropDownList)[^]
CascadingDropDown Demonstration[^]
Cascading DropDownList in ASP.NET MVC[^]
Creating Cascading DropDownLists in ASP.Net[^]
Using CascadingDropDown with a Database[^]



检查此
Hi ,
Check this
Dropdownlist[^]
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        DropDownList1.Items.Add("select");
        DropDownList1.Items.Add("Animal");
        DropDownList1.Items.Add("Vehicle");

    }
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    if (DropDownList1.SelectedIndex == 1)
    {
        DropDownList2.Items.Clear();
        DropDownList2.Visible = true;
        DropDownList2.Items.Add("cat");
    }
    else if(DropDownList1.SelectedIndex == 2)
    {
        DropDownList2.Items.Clear();
        DropDownList2.Visible = true;
        DropDownList2.Items.Add("car");
    }
    else if (DropDownList1.SelectedIndex == 0)
    {
        DropDownList2.Visible = false;
        DropDownList2.Items.Clear();
    }
}





<div>
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"

        onselectedindexchanged="DropDownList1_SelectedIndexChanged">
    </asp:DropDownList>
    <asp:DropDownList ID="DropDownList2" runat="server" Visible="False">
    </asp:DropDownList>

</div>



最好的问候
米特瓦里(M.Mitwalli)



Best Regards
M.Mitwalli


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

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