protected void btnDelete_Click(object sender, EventArgs e) { try { if (lblId.Text == "-1") { return; } else { Person person = new Person(); person.Id = int.Parse(lblId.Text); personRepository = new PersonData(); personRepository.RemovePerson(person); ReturnToList(); } } catch (Exception ex) { AddMessage(ex); } }