Click here to Skip to main content
15,889,860 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
How can i fill the second dropdownlist with corresponding value of first dropdownlist

Ex. If i select state in first dropdownlist then it should show only the selected state's city in the second dropdownlist.
Posted

 
Share this answer
 
This is one of the mist frequent question asked over here. Check this out
http://www.codeproject.com/search.aspx?q=cascading+dropdown&x=0&y=0&sbo=qa&usfc=false[^]
 
Share this answer
 
In ddlstate_selectedindexchanged()
{
//get the cities corresponding to that state
then bind those
}

you should place update panels for those two dropdown list and
put autopostback=true for state dropdown list.


and one more in city table there should be a state id column then only you can get the corresponding cities.
 
Share this answer
 
v2

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