删除具有分页的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();

        }
posted @ 2007-05-09 13:10  花香的蜂  阅读(218)  评论(0编辑  收藏  举报