select country in drop down and state accordingly
Hi, i have 2 dropdownlist and i want when i select country from first drop down second drop down should show the states of that country.
i had made 2 tables - one is country and other is states.
country has 2 column - country_id and country_name
state has 3 column - state_id, country_id and state_name.
country id in state table is as fk .
and i am trying this ,, plz help me---
string id = ddlcountry.SelectedValue;
string qry = "select State_Name from State where Country_ID=(Select Country_ID from Country where Country_Name='" + id +"')";
SqlDataAdapter adp = new SqlDataAdapter(qry,con);
DataSet ds = new DataSet();
ddlstate.DataValueField = "State_Name";
ddlstate.DataSource = ds;