protected void btnDel_Click(object sender, EventArgs e) { int delcount = 0; for (int i = 0; i < gridView.Rows.Count; i++) { CheckBox chkSel = (CheckBox)gridView.Rows[i].Cells[0].FindControl("chkSelect"); if (chkSel.Checked == true) { if (cBLL.Delete((int)gridView.DataKeys[i].Value) > 0) { delcount++; } } } if (delcount != 0) { gridView.DataBind(); ShowMessage("刪除" + delcount + " 筆資料成功"); } else { ShowMessage("請至少選擇一筆資料"); } }
protected void grdContactsRowDelete(object sender, GridViewDeleteEventArgs e) { if (ContactBLL.Delete(e.Keys[0]) != 0) { msg.Text = "Запис видалено"; gridFill(); } else { msg.Text = "Запис не видалено"; } }
protected void bt3_Click(object sender, EventArgs e) { try { int id = int.Parse(tb11.Text); ContactBLL.Delete(id); ltrContacts.Text = getAll(); refreshBoxes(); } catch (Exception err) { lblErrorMessage1.Text = "Error " + err.Message; } }
public void deleteRecord(int id) { contacts.Delete(id); }