protected void DropDownList_state_SelectedIndexChanged(object sender, EventArgs e) { int id = int.Parse(DropDownList_state.SelectedItem.Value); bs.sid = id; DropDownList_city.DataSource = bs.bs_city(bs); DropDownList_city.DataTextField = "CITY"; DropDownList_city.DataValueField = "CITY"; DropDownList_city.DataBind(); }
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; Bind(); HiddenField gen = GridView1.Rows[e.NewEditIndex].FindControl("HiddenField1") as HiddenField; RadioButtonList rd = GridView1.Rows[e.NewEditIndex].FindControl("RadioButtonList1") as RadioButtonList; rd.SelectedValue = gen.Value; HiddenField age = GridView1.Rows[e.NewEditIndex].FindControl("HiddenField2") as HiddenField; DropDownList ddage = GridView1.Rows[e.NewEditIndex].FindControl("DropDownList1") as DropDownList; ddage.SelectedValue = age.Value; HiddenField st = GridView1.Rows[e.NewEditIndex].FindControl("HiddenField3") as HiddenField; DropDownList ddst = GridView1.Rows[e.NewEditIndex].FindControl("DropDownList_state") as DropDownList; ddst.DataSource = bs.bs_state(); ddst.DataTextField = "STATE"; ddst.DataValueField = "SID"; ddst.DataBind(); HiddenField ct = GridView1.Rows[e.NewEditIndex].FindControl("HiddenField4") as HiddenField; DropDownList ddct = GridView1.Rows[e.NewEditIndex].FindControl("DropDownList_city") as DropDownList; int id = int.Parse(ddst.SelectedItem.Value); bs.sid = id; ddct.DataSource = bs.bs_city(bs); ddct.DataTextField = "CITY"; ddct.DataValueField = "CITY"; ddct.DataBind(); }