删除具有分页的DataGrid,当前页不为0且当前页的记录只有一条的时候的解决方案 private void dgShow_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if(dgShow.Items.Count==1) { if(dgShow.CurrentPageIndex!=0) dgShow.CurrentPageIndex = dgShow.CurrentPageIndex-1; } string strSql = "delete from tbStudentinfo where studentid="+e.Item.Cells[0].Text+""; ExecuteSql(strSql); BindData(); } 这里和大家分享和学习如何学IT!