Click here to Skip to main content
15,867,888 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello...how can I related 2 different dropdownlist with a different SQLSource.
For example if I choose the first dropdownlist value, the value in second dropdownlist also change?
Posted
Comments
Mahendra.p25 3-Apr-11 23:15pm    
please elaborate your question
nazila24 3-Apr-11 23:33pm    
ok....for example, the first dropdownlist there are state in city, and second dropdownlist there are date of course organised...So when i choose the date of course organised, it will display the state that organised courses.

hi,

it means you have to tables in the database

bind your date of course table with first drop down as

dropdown1.datasource = your datasource 
dropdown1.datatextfield= "name"
dropdown1.datavaluefield="id"
dropdown1.databind


then on the selected index changed of that dropdown
int i= Connvert.toInt32(ddl.selectedvalue)


on the basis of that id you can get record from your second table and bind that with your dropdown2
 
Share this answer
 
v2
Comments
Monjurul Habib 4-Apr-11 2:48am    
add code block.
You may like to try - AJAX CascadingDropDown[^]
 
Share this answer
 
Comments
Аslam Iqbal 4-Apr-11 14:06pm    
good link.
Ankur\m/ 5-Apr-11 1:10am    
Good link deserves good points, right?! :)
Аslam Iqbal 16-Apr-11 1:01am    
You are right. check it now. 5
Ankur\m/ 16-Apr-11 1:07am    
Thank you!
Creating Cascading DropDownLists in ASP.Net
AJAX.NET Cascading Dropdownlist
More

I hope the above information will be helpful. If you have more concerns, please let me know.
 
Share this answer
 
Comments
Аslam Iqbal 4-Apr-11 14:07pm    
good link too.
Monjurul Habib 4-Apr-11 17:09pm    
thank you.

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