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