private void DeleteCompanyData() { bool result = false; try { GridViewRow oGridViewRow = gvCompany.Rows[Convert.ToInt32(ViewState["index"])]; Label lblCompanyId = (Label)oGridViewRow.FindControl("lblCompanyId"); CompanyDTO oCompanyDTO = new CompanyDTO(); oCompanyDTO.CompanyId = Convert.ToInt32(lblCompanyId.Text); oCompanyDTO.Status = (int)Status.Inactive; oCompanyDTO.ModifiedUser = Session["UserID"].ToString(); oCompanyDTO.ModifiedDateTime = DateTime.Now; oCompanyDTO.ModifiedMachine = Session["UserMachine"].ToString(); result = oWebApiCalls.DeleteCompanyData(oCompanyDTO); if (result == true) { ResetControllers(); Messages("Company Deleted Successfully!!"); } else { Messages("Connection Error!"); } } catch (Exception ex) { lblError.Text = ex.Message.ToString(); throw ex; } }