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