protected void DataList1_DeleteCommand(object sender, DataListCommandEventArgs e) { NoticeArticleBLL noticearticlebll2 = new NoticeArticleBLL(); string id = e.CommandArgument.ToString(); if (noticearticlebll2.Delete(id)) { Response.Write("<script>alert('删除成功');</script>"); } this.Response.Redirect(this.Request.Url.ToString()); }
protected void Delete_Click(object sender, EventArgs e) { for (int i = 0; i < DataList1.Items.Count; i++) { if (((CheckBox)DataList1.Items[i].FindControl("selected")).Checked == true) { object s = ((System.Web.UI.WebControls.HyperLink)DataList1.Items[i].FindControl("Hyperlink3")).Text; NoticeArticleBLL noticearticlebll = new NoticeArticleBLL(); if (noticearticlebll.Delete(s)) { Response.Write("<script>alert('删除成功');</script>"); } } } this.Response.Redirect(this.Request.Url.ToString()); }