protected void Button2_Click(object sender, EventArgs e) { try { List <int> selectedRows = new List <int>(); foreach (GridViewRow gvr in GridView1.Rows) { if ((gvr.FindControl("CheckBox2") as CheckBox).Checked == true) { selectedRows.Add(gvr.Cells[0].Text.ToInt()); } } if (selectedRows.Count > 0) { VLecturersRepository vstdir = new VLecturersRepository(); vstdir.Deletelec(selectedRows); // vstdir.Deletelecturer(selectedRows); LoadStdData(); PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgDeleteSuccessfull, Color.Green); EmailContactsRepository emrir = new EmailContactsRepository(); emrir.DeletepersonEmailContact(selectedRows); LoadStdData(); PersonTools.ShowMessage(lblmessage, Resources.DashboardText.msgDeleteSuccessfull, Color.Green); TelContactsRepository trir = new TelContactsRepository(); trir.DeletepersonTelContact(selectedRows); LoadStdData(); } } catch { PersonTools.ShowMessage(lblmessage, Resources.DashboardText.errDeleteFailed, Color.Red); } }