vs2005中的下拉菜单怎么联系起来

来源:百度知道 编辑:UC知道 时间:2024/05/29 01:25:10

先新建两个下拉菜单再打下面的代码:

protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.DropDownList2.SelectedValue == "浙江")
{
DropDownList3.Items.Insert(1, new ListItem("杭州"));
DropDownList3.Items.Insert(2, new ListItem("温州"));
DropDownList3.Items.Insert(3, new ListItem("宁波"));
DropDownList3.Items.Remove(new ListItem("长沙"));
DropDownList3.Items.Remove(new ListItem("衡阳"));
DropDownList3.Items.Remove(new ListItem("湘乡"));
DropDownList3.Items.Remove(new ListItem("成都"));
DropDownList3.Items.Remove(new ListItem("德阳"));
DropDownList3.Items.Remove(new ListItem("绵阳"));
}

if (this.DropDownList2.SelectedValue == "湖南")
{