很简单的
GridView1.DataSource = Data.mytable(txt) ;
GridView1.AllowPaging = true;
GridView1.PageSize = 20;
GridView1.DataBind();
firstpage.Enabled = true;
lastpage.Enabled = true;
nextpage.Enabled = true;
if (GridView1.PageIndex == 0)
{
firstpage.Enabled = false;
lastpage.Enabled =false ;
}
else if (GridView1.PageIndex == (GridView1.PageCount-1 ))
{
nextpage .Enabled = false;
}