I have 3 dropdownlists and I already set dropdownlist 2 based on SelectedValue of dropdownlist 1, but my dropdownlist 3 has no response based on selection in dropdownlist2
if(DropDownList1.SelectedValue =="1")
{
DropDownList2.Items.Clear();
DropDownList2.Items.Insert(0, new ListItem("A", ""));
DropDownList2.Items.Insert(1, new ListItem("B", ""));
}
This is how I add items in Dropdownlist2 based on selection in Dropdownlist1 but it does not work in the third dropdownlist whic does not have any item after I select A in Dropdownlist2:
if (DropDownList2.SelectedValue == "0")
{
DropDownList3.Items.Clear();
DropDownList3.Items.Insert(0, new ListItem("A-1", ""));
}
selectedIndexnotselectedvalueright? added an answer and explanation