Ejemplo n.º 1
0
    protected void DropDown_state_SelectedIndexChanged(object sender, EventArgs e)
    {
        int id = int.Parse(DropDown_state.SelectedItem.Value);

        bs.sid = id;
        DropDown_city.DataSource     = bs.bs_citybind(bs);
        DropDown_city.DataTextField  = "City";
        DropDown_city.DataValueField = "City";
        DropDown_city.DataBind();
    }
Ejemplo n.º 2
0
    protected void DropDown_state_SelectedIndexChanged(object sender, EventArgs e)
    {
        int           id  = int.Parse(DropDown_state.SelectedItem.Value);
        SqlConnection con = new SqlConnection(str);
        SqlCommand    cmd = new SqlCommand();

        cmd.CommandText = "dd_city";
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Connection  = con;

        cmd.Parameters.AddWithValue("@id", id);

        SqlDataAdapter ad = new SqlDataAdapter(cmd);
        DataTable      dt = new DataTable();

        ad.Fill(dt);

        DropDown_city.DataSource     = dt;
        DropDown_city.DataTextField  = "CITY";
        DropDown_city.DataValueField = "SID";
        DropDown_city.DataBind();
    }