DropDownList关联问题
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e){
string[] CarArray = new string[4] { "Ford", "Honda", "BMW", "Dodge" };
string[] AirplaneArray = new string[3] { "Boeing 777", "Boeing 747", "Boeing 737" };
string[] TrainArray = new string[3] { "Bullet Train", "Amtrack", "Tram" };
if (DropDownList1.SelectedValue == "Car")
{
DropDownList2.DataSource = CarArray;
}
else if (DropDownList1.SelectedValue == "Airplane")
{
DropDownList2.DataSource = AirplaneArray;
}
else
{
DropDownList2.DataSource = TrainArray;
}
DropDownList2.DataBind();
DropDownList2.Visible = true;
为什么在改变DropDownList1的内容DropDownlist2的内容没有跟着变