protected void DropDowncurrentState_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownpermanentState.SelectedIndex != 0) { byte stateId = byte.Parse(DropDowncurrentState.SelectedValue); DropDowncurrentDistrict.DataSource = mpDetailsBAL.loadDistrict(stateId); DropDowncurrentDistrict.DataTextField = "districtName"; DropDowncurrentDistrict.DataValueField = "districtId"; DropDowncurrentDistrict.DataBind(); DropDowncurrentDistrict.Items.Insert(0, new ListItem("Select District", "0")); } else { DropDowncurrentDistrict.Items.Clear(); DropDowncurrentDistrict.Items.Insert(0, new ListItem("Select Distirict", "0")); } }
protected void loadcurrentDistrict() { if (DropDowncurrentState.SelectedIndex != 0) { byte stateId = byte.Parse(DropDowncurrentState.SelectedValue); DropDowncurrentDistrict.DataSource = mpDetailsBAL.loadDistrict(stateId); DropDowncurrentDistrict.DataTextField = "districtName"; DropDowncurrentDistrict.DataValueField = "districtId"; DropDowncurrentDistrict.DataBind(); DropDowncurrentDistrict.Items.Insert(0, new ListItem("Select District", "0")); string cDistrict = dt1.Rows[0]["currentDistrict"].ToString(); DropDowncurrentDistrict.Items.FindByText(cDistrict).Selected = true; } else { DropDowncurrentDistrict.Items.Clear(); DropDowncurrentDistrict.Items.Insert(0, new ListItem("Select Distirict", "0")); } }