Exemplo n.º 1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        int m = 0;

        Fannie.InitSystem init = new Fannie.InitSystem();
        for (int i = 0; i < gvMajor.Rows.Count; i++)
        {
            if (((CheckBox)(gvMajor.Rows[i].FindControl("cbSelect"))).Checked)
            {
                int id = Convert.ToInt32(gvMajor.DataKeys[i].Value.ToString());
                init.DeleteMajor(id);
            }
            else
            {
                m++;
            }
        }
        if (m == gvMajor.Rows.Count)
        {
            Response.Write("<script>alert('请先选择需要删除的记录')</script>");
        }
        else
        {
            GetMajor();
        }
    }
Exemplo n.º 2
0
    protected void gvMajor_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int id = Convert.ToInt32(gvMajor.DataKeys[e.RowIndex].Value.ToString());

        Fannie.InitSystem init = new Fannie.InitSystem();
        if (init.DeleteMajor(id) > 0)
        {
            GetMajor();
            Response.Write("<script>alert('删除成功')</script>");
        }
    }