You also Try this:
make Both Dropdown Autopost Back Proprty = True..
on Page Load Event :
if (!IsPostBack)
{
FillDropDownList();
FillDropDownList1();
}
The Function is :
private void FillDropDownList()
{
DataSet ds = new DataSet();
SqlDataAdapter myda = new SqlDataAdapter("select city from tablename ",con);
myda.Fill(ds);
drop_city.DataSource = ds;
drop_city.DataValueField = "city";
drop_city.DataBind();
}
private void FillDropDownList1()
{
DataSet ds = new DataSet();
SqlDataAdapter myda = new SqlDataAdapter("select city from tablename ",con);
myda.Fill(ds);
drop_city1.DataSource = ds;
drop_city1.DataValueField = "city";
drop_city1.DataBind();
}
Double Click on drop_city1 Drop down
string str="Select km from tablename where city ='"+drop_city.SelectedItem.Value+"' and city1='"+drop_city1.SelectedItem.Value+"'";
SqlDataAdapter ad = new SqlDataAdapter(str,connection object);
DataSet ds = new DataSet();
ad.Fill(ds);
if (ds.Tables[0].Rows.Count != 0)
{
Textbox1.Text = ds.Tables[0].Rows[0][0].ToString();
}
if any query, please post it....