protected void delete_Click(object sender, EventArgs e) { try { int id = int.Parse(testDrop.SelectedItem.Value.ToString()); SQL sql = new SQL(); bool check = sql.preTestCleanChecks(id); if (check) { error.InnerText = "There are still users associated with the following test id: " + id; error.Visible = true; } else { sql.cleanupTests(id); Reload(); } } catch (Exception) { error.Visible = true; } }