private void DistrictInsertUpdate() { try { districtBLLObj.distName = Convert.ToString(txtDistrictName.Text); districtBLLObj.stateId = Convert.ToInt32(Convert.ToString(ddlState.SelectedValue)); if (Convert.ToString(ViewState["districtId"]) == "") { status = districtBLLObj.BLLDistrictInsert(districtBLLObj); if (status > 0) { Response.Write("<script> alert('District Added')</script>"); } else { Response.Write("<script> alert('District Not Added')</script>"); } } else { districtBLLObj.distId = Convert.ToInt32(Convert.ToString(ViewState["districtId"])); status = districtBLLObj.BLLDisrtictUpdate(districtBLLObj); if (status > 0) { Response.Write("<script> alert('District Updated')</script>"); } else { Response.Write("<script> alert('District Not Updated')</script>"); } ShowAllDistrict(); FillDLLState(); } } catch (Exception ex) { throw ex; } }