下拉列表框三级联动,下面的代码只能实现二级联动,三级就不可以了,为什么? 5
privatevoidprov_SelectedIndexChanged(objectsender,EventArgse){if(prov.SelectedItem.Eq...
private void prov_SelectedIndexChanged(object sender, EventArgs e)
{
if (prov.SelectedItem.Equals("湖北"))
{
city.Items.Clear();
city.Items.AddRange(new object[] {
"武汉",
"宜昌",
"荆门"});
}
else if (prov.SelectedItem.Equals("广东"))
{ city.Items.Clear();
city.Items.AddRange(new object[]{"广州"});
}
else if (prov.SelectedItem.Equals("江西"))
{
city.Items.Clear();
city.Items.AddRange(new object[] {
"南昌",
"九江",
"鹰潭"});
}
else if (prov.SelectedItem.Equals("云南"))
{
city.Items.Clear();
city.Items.AddRange(new object[] {
"昆明",
"丽江",
"保山"});
}
}
private void city_SelectedIndexChanged(object sender, EventArgs e)
{
if (city.SelectedItem.Equals("广州"))
{
district.Items.Clear();
district.Items.AddRange(new object[] {
"花都",
"新华",
"雅瑶"});
}
}
private void district_SelectedIndexChanged(object sender, EventArgs e)
{
} 展开
{
if (prov.SelectedItem.Equals("湖北"))
{
city.Items.Clear();
city.Items.AddRange(new object[] {
"武汉",
"宜昌",
"荆门"});
}
else if (prov.SelectedItem.Equals("广东"))
{ city.Items.Clear();
city.Items.AddRange(new object[]{"广州"});
}
else if (prov.SelectedItem.Equals("江西"))
{
city.Items.Clear();
city.Items.AddRange(new object[] {
"南昌",
"九江",
"鹰潭"});
}
else if (prov.SelectedItem.Equals("云南"))
{
city.Items.Clear();
city.Items.AddRange(new object[] {
"昆明",
"丽江",
"保山"});
}
}
private void city_SelectedIndexChanged(object sender, EventArgs e)
{
if (city.SelectedItem.Equals("广州"))
{
district.Items.Clear();
district.Items.AddRange(new object[] {
"花都",
"新华",
"雅瑶"});
}
}
private void district_SelectedIndexChanged(object sender, EventArgs e)
{
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询