private void DeleteKeyWords(string KWId) { B_KeyWord bkeywords = new B_KeyWord(); if (bkeywords.DeleteByID(KWId)) { HttpContext.Current.Response.Write("<script language=javascript> alert('删除成功!');window.document.location.href='KeyWordManage.aspx';</script>"); } }
protected void btndelete_Click(object sender, EventArgs e) { B_KeyWord bkeyword =new B_KeyWord(); int i = 0, flag = 0; string sid = ""; for (i = 0; i < GridView1.Rows.Count; i++) { if (((CheckBox)GridView1.Rows[i].Cells[0].FindControl("SelectCheckBox")).Checked) { sid = GridView1.DataKeys[GridView1.Rows[i].RowIndex].Value.ToString(); if (bkeyword.DeleteByID(sid)) flag++; } } if (flag > 0) { Response.Write("<script language=javascript> alert('批量删除成功!');window.document.location.href='KeyWordManage.aspx';</script>"); } }