c# - i have a problem with dropdownLists -


i have dictionary looks dictionary<string,string[]>

i have 2 dropdownlist. want second dropdownlist present data depending on item first dropdropdownlist chosen.

so added event second dropdownlist..here algorithm:

protected void topicdropdownmenu_selectedindexchanged1(object sender, eventargs e) {     string[] chosenitem;     chosenitem = null;     subtopicdropdownlist.clearselection();      chosenitem = topic[topicdropdownmenu.selecteditem.value];      foreach (string item in chosenitem)     {         subtopicdropdownlist.items.add(item);     }  } 

what happens, array of strings added second dropdownlist each time select item first dropdownlist..

but want second dropdownlist replace values depending on chosen in first dropdownlist, instead of adding values whatever placed in second drop down list

// add line - it's different clearselection() subtopicdropdownlist.items.clear();  foreach (string item in chosenitem) {     subtopicdropdownlist.items.add(item); } 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -