using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace WebApplication1
{
    public partial class 新闻删除 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow gvr in this.GridView1.Rows)
            {
                Control ctl = gvr.FindControl("chk_id");
                CheckBox ck = (CheckBox)ctl;
                if (ck.Checked)
                {
                    TableCellCollection cell = gvr.Cells;
                    BLL.news ne = new BLL.news();
                    if (ne.delete(cell[0].Text))
                    {
                        Response.Write("<script>alert('删除成功！')</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('删除失败！')</script>");
                    }
                    Response.Redirect("新闻删除.aspx");
                }
            }
        }
    }
}
