/// <summary> /// 删除所选文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { int count = 0; int flag = this.MailList.Rows.Count; Fannie.Mail ml2 = new Fannie.Mail(); for (int i = 0; i < flag; i++) { CheckBox cb = (CheckBox)this.MailList.Rows[i].FindControl("CB1"); if (cb.Checked == true) { ml2.DeleteMail(Convert.ToInt32(MailList.DataKeys[i].Value.ToString())); } else { count++; } } if (count == flag) { Response.Write("<script>alert('请先选择需要删除的记录');window.location.href='ReportOutbox.aspx';</script>"); } else { Response.Write("<script>alert('已经删除所选记录');window.location.href='ReportOutbox.aspx';</script>"); } }
//删除本条记录 protected void Delete_Click(object sender, EventArgs e) { Fannie.Mail ml = new Fannie.Mail(); int flag = ml.DeleteMail(MailID); if (flag > 0) { Response.Write("<script>alert('此信息已被删除!');window.location='ReportOutbox.aspx';</script>"); } else { Response.Write("<script>alert('信息未被删除!');window.location='ReportOutboxRead.aspx';</script>"); } }