protected void DropDownState_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownState.SelectedIndex != 0) { byte stateId = byte.Parse(DropDownState.SelectedValue); DropDownconstituency.DataSource = mpDetailsBAL.loadConstituency(stateId); DropDownconstituency.DataTextField = "constituency"; DropDownconstituency.DataValueField = "constituencyId"; DropDownconstituency.DataBind(); DropDownconstituency.Items.Insert(0, new ListItem("Select Constituency", "0")); } else { DropDownconstituency.Items.Clear(); DropDownconstituency.Items.Insert(0, new ListItem("Select Constituency", "0")); } }
protected void DropDownState_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownState.SelectedIndex != 0) { byte stateId = byte.Parse(DropDownState.SelectedValue); DropDownconstituency.DataSource = mpDetailsBAL.loadConstituency(stateId); DropDownconstituency.DataTextField = "constituency"; DropDownconstituency.DataValueField = "constituencyId"; DropDownconstituency.DataBind(); DropDownconstituency.Items.Insert(0, new ListItem("Select Constituency", "0")); string pconstituency = dt1.Rows[0]["constituency"].ToString(); DropDowncurrentState.Items.FindByText(pconstituency).Selected = true; } else { DropDownconstituency.Items.Clear(); DropDownconstituency.Items.Insert(0, new ListItem("Select Constituency", "0")); } }