Ejemplo n.º 1
0
 private void DeleteSource(string SId)
 {
     B_Author bauthor = new B_Author();
     if (bauthor.DeleteByID(SId))
     {
         HttpContext.Current.Response.Write("<script language=javascript> alert('删除成功!');window.document.location.href='AuthorManage.aspx';</script>");
     }
 }
Ejemplo n.º 2
0
    protected void btndelete_Click(object sender, EventArgs e)
    {
        B_Author bauthor = new B_Author();
        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 (bauthor.DeleteByID(sid))
                    flag++;

            }
        }
        // GridView1.DataKeys[GridView1.Rows[i].RowIndex]//而不是.DataItemIndex
        if (flag > 0)
        {
            Response.Write("<script language=javascript> alert('批量删除成功!');window.document.location.href='AuthorManage.aspx';</script>");

        }
    }