コード例 #1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        int m = 0;

        Fannie.Student s = new Fannie.Student();
        for (int i = 0; i < gvStudent.Rows.Count; i++)
        {
            if (((CheckBox)(gvStudent.Rows[i].FindControl("cbSelect"))).Checked)
            {
                s.DeletOneStu(gvStudent.DataKeys[i].Value.ToString());
            }
            else
            {
                m++;
            }
        }
        if (m == gvStudent.Rows.Count)
        {
            Response.Write("<script>alert('请先选择需要删除的记录')</script>");
        }
        else
        {
            GetAllStu();
        }
    }
コード例 #2
0
 protected void gvStudent_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     Fannie.Student s = new Fannie.Student();
     s.DeletOneStu(gvStudent.DataKeys[e.RowIndex].Value.ToString());
     GetAllStu();
 }