protected void btnDel_Click(object sender, EventArgs e) { int delcount = 0; for (int i = 0; i < GridView1.Rows.Count; i++) { CheckBox chkSel = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("chkSelect"); if (chkSel.Checked == true) { delcount++; if (aBLL.Delete((int)GridView1.DataKeys[i].Value) > 0) { ShowMessage("刪除成功"); } } } if (delcount != 0) { this.ShowMessage(this.Getmessage("30014") + " 刪除數:" + delcount); } else { this.ShowMessage(this.Getmessage("30013") + " 請至少選擇一筆資料"); } GridView1.DataBind(); }
protected void DeleteButton_Click(object sender, EventArgs e) { CheckAdminPower("DeleteArticle", PowerCheckType.Single); string deleteID = RequestHelper.GetIntsForm("SelectID"); string[] ids = RequestHelper.GetIntsForm("SelectID").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (ids.Length > 0) { ArticleBLL.Delete(Array.ConvertAll <string, int>(ids, k => Convert.ToInt32(k))); AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Article"), deleteID); ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), RequestHelper.RawUrl); } }
protected void Button1_Click(object sender, EventArgs e) { string wherestring = ""; for (int i = 0; i < ArticleGridView.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)ArticleGridView.Rows[i].FindControl("CheckBox1"); if (cbox.Checked) { wherestring += ArticleGridView.DataKeys[i].Value + ","; } } if (wherestring.Length > 0) { wherestring = wherestring.TrimEnd(','); wherestring = "ID in(" + wherestring + ")"; ArticleBLL articleBLL = new ArticleBLL(); var result = articleBLL.Delete(new Article(), wherestring); if (result) { Label1.Text = "删除成功"; } } }
public async Task <IActionResult> Delete(int id = 0) { return(Json(await service.Delete(id))); }