Hi all. I am using Microsoft Visual Web Developer C# and am working with a database.

I am using 2 tables: CONTINENT table with fields: CONTINENT_CODE and CONTINENT_NAME

The other table is COUNTRIES with fields: COUNTRY_CODE and COUNTRY_NAME

The 1 dropdownlist is bound to the CONTINENT table and displays the CONTINENT_NAME (with its value CONTINENT_CODE)

The 2nd dropdownlist is bound to the COUNTRY TABLE and displays COUNTRY_NAME (with its value COUNTRY_CODE).

Now my question is what should you do in order for when a user selects Europe, England appears in drop down list and not China (vice a versa). Thanks

So with regard to these two tables, do you have a foreign key in the COUNTRY Table that creates a relationship between the countries and continents?

If so, what you can do is have the dropdown list autopostback (autopostback=true) when a user makes a selection in the first dropdown list, in the Page Load block (IsPostBack), check the selected value of the first dropdown and use the value to do a lookup of the COUNTRY table to populate dropdown list #2 with the correct items.

Of course, this can be done via AJAX as well to prevent the post back and pull the data behind the scenes. It adds more complexity but is doable. If you are not familiar with either option, try the postback option first so that you get familiar with it, then you can get fancy and add in the AJAX bells and whistles...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.