Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends
I am developing windows application using c#. I have a two comboboxes 1.combox1 for country, 2.combobox2 for state
In the page_load event of form data(country name) has been boundto combobox(combobox1) from sql server. then i add another data(state name) to comobobox(combobox2)from sql based on the first combobox selected value by using combobox1_selectedindexchanged event.but the problem is combobox1_selectedindexchanged event occurs at the page_load event itself. but what i need is combobox2 value is added after selecting the value from first combobox1. what would be problem on my process.
Posted
Updated 8-Aug-12 3:57am
v2
Comments
bbirajdar 8-Aug-12 11:12am    
Repost of http://www.codeproject.com/Questions/436701/problem-in-country-state-city-binding-to-combobox

It is normal behaviour for the combobox selectedindex changed event to occur this way. Chances are the selected index is -1 and you just have to check for that value and do nothing in that case or clear the second combo because nothing is selected in the first combo.
 
Share this answer
 
To avoid this kind of problems you can use SelectionChangeCommitted event.
 
Share this answer
 
Comments
baskaran chellasamy 8-Aug-12 10:06am    
This event also not working.please give me any sample code in window application for binding country,state,city based on the combobox selected value.

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