解決方法如下:
給GridView控件添加一個事件PageIndexChanging,並設置GridView的屬性:AllowPaging="True"
復制代碼 代碼如下:
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.datasource="數據源"; GridView1.DataBind();
}