protected void Delete_Click(object sender, EventArgs e) { try { CheckBox chk = new CheckBox(); Label lbl = new Label(); string patid = ""; PatientDataTier std = new PatientDataTier(); if (grdStudents.Rows.Count > 0) { foreach (GridViewRow row in grdStudents.Rows) { chk = (CheckBox)row.FindControl("chkPatID"); if (chk.Checked) { lbl = (Label)row.Controls[0].FindControl("hidPatID"); patid = lbl.Text.Trim(); std.DeletePatient(patid); } } DataBind(); } } catch { } }