Database for fetching city name
protected void Page_Load(object sender, EventArgs e)
{
drop2();
drop();
}
public void drop2()
{
if (DropDownList4.SelectedItem.Text == "--Selectcountry--")
{
DropDownList5.Enabled = false;
DropDownList5.SelectedValue = null;
}
else
DropDownList5.Enabled = true;
}
Autopost enabled in Dropdownlist of country
public void drop()
{
con.Open();
string s = "select ward from country where cont='" + DropDownList4.SelectedValue.ToString() + "'";
SqlCommand cmd = new SqlCommand(s, con);
SqlDataReader dr = cmd.ExecuteReader();
DropDownList5.DataSource = dr;
DropDownList5.DataTextField = "city";
DropDownList5.DataValueField = "city";
DropDownList5.DataBind();
con.Close();
}
protected void Page_Load(object sender, EventArgs e)
{
drop2();
drop();
}
public void drop2()
{
if (DropDownList4.SelectedItem.Text == "--Selectcountry--")
{
DropDownList5.Enabled = false;
DropDownList5.SelectedValue = null;
}
else
DropDownList5.Enabled = true;
}
Autopost enabled in Dropdownlist of country
public void drop()
{
con.Open();
string s = "select ward from country where cont='" + DropDownList4.SelectedValue.ToString() + "'";
SqlCommand cmd = new SqlCommand(s, con);
SqlDataReader dr = cmd.ExecuteReader();
DropDownList5.DataSource = dr;
DropDownList5.DataTextField = "city";
DropDownList5.DataValueField = "city";
DropDownList5.DataBind();
con.Close();
}

No comments:
Post a Comment