0

In my registeration form i have fields named country and city. I want that i select a country lets say USA then city field should show all the cities in USA.
i know that i have to put all the cities in Database and then bind it to dropdown box , putting IF statements etc blah blah !!!
but isn't there some alternative to do it , to save time ? it would take alot of time to code. HELP !!!

2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by HunainHafeez
0

You don't have to be lazy. Thats the best practice, Thats the demand of coding. You would need to create 2 tables, one for the city and another for the country. You obviously need to link up the 2 tables by having the primary key of country table as a forein key in the city table.

after that you want to bind your country drop down with the data from country and you also want to enable the autopostback property of your drop down.
you will then have to bind data on the city drop down in the index changed event of the country drop down. Makes sense?

0

awesome !!! i had kinda idea about that but you made it clear !!! thanks !!!
and sorry , i didn't mean to be lazy but i have a very shoert time to submit my project, (fianl year project) and i coded alot. so making shortcuts for things like this!!! but doesn't matter, as u said, i vl code it. Thanks !!!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.