Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create a Dropdownlist in asp.net for cities of India.
i want to show cities statewise in single ddl where state name is an unselected item
with different background.
How could i do it.
Please send me the code.

Thanks in advance.
Posted
Updated 16-Aug-11 9:03am
v2
Comments
Herman<T>.Instance 16-Aug-11 13:40pm    
How many cities there are in India?
Isn't it better to have 2 dropdownlists? One for the statenames and one that shows the cityname per statename

If you set the item, that you do not want to be selectable as "disabled" that should work.
 
Share this answer
 
Hi,i solved this problem.
first i fill the ddl by cities according to state using loop from xml.
then in the value field of items i fill the attribute id of state and cities.
Again i write a javascript function.
in this function by checking value of each option. if value is type state then the disabled="disabled";
It works.
 
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