Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I have three dropdownlists 'countrydropdown', 'statedropdown', and 'citydropdown'. All the dropdownlists are connected to each other. If we change a value in 'countrydropdown', the list in 'statedropdown' will change automatically.
Now I wanted to change value of 'countrydropdown', 'statedropdown' and 'citydropdown' programatically, but any change of 'countrydropdown' list does not affect list of 'statedropdown'. Please suggest me how to refresh dropdownlist programatically.
Posted
Updated 28-Nov-10 1:42am
v2
Comments
JF2015 28-Nov-10 7:42am    
Edited to remove tags.

I assume you are handling an event from "countrydropdown" that updates "statedropdown", and this is what gives you the problem?

If so, then you will need to either:

1) Create a class level bool which says "I'm updating - ignore events"
or
2) Disable the event handler until updates are complete.

I would go with the former.
 
Share this answer
 
Use SelectedValueChanged event. it will work.

to idintify the selected value of current combo use ComboBox1.Text or ComboBox1.SelectedItem to get value for next combobox.
if you are using ASP.NET then check the
AutoPostBack="TRUE"

The AutoPostBack property is used to set or return whether or not an automatic post back occurs when the user presses "ENTER" or "TAB" in the TextBox control.

If this property is set to TRUE the automatic post back is enabled, otherwise FALSE. Default is FALSE.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900