Exemplo 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>");
        }
    }
Exemplo 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>");
        }
    }
        protected void btndelete_Click(object sender, EventArgs e)
        {
            B_Author bauthor = new B_Author();
            int      flag = 0; string sid = "";

            string[] chkArr = GetChecked();
            if (chkArr != null)
            {
                for (int i = 0; i < chkArr.Length; i++)
                {
                    sid = chkArr[i];
                    if (bauthor.DeleteByID(sid))
                    {
                        flag++;
                    }
                }
            }
            if (flag > 0)
            {
                Response.Write("<script language=javascript> alert('批量删除成功!');window.document.location.href='AuthorManage.aspx';</script>");
            }
        }