protected void btnAdd_Click(object sender, EventArgs e) { if (Page.IsValid) { if (dropCountry.SelectedIndex != 0) { StateBO.countryId = int.Parse(dropCountry.SelectedValue.ToString()); StateBO.noOfConstituency = byte.Parse(txtNoConsti.Text); StateBO.state = txtstate.Text; bool res = stateBAL.stateInsert(StateBO); if (res == true) { ClientScript.RegisterStartupScript(this.GetType(), "myfunction", "stateInserted()", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "myfunction", "stateInsertedFail()", true); } } else { ClientScript.RegisterStartupScript(this.GetType(), "myfunction", "selectCountry()", true); } } }