2008-09-17 84 views
0

幫助我..我的頁面索引不能在Visual Studio中工作。 網頁的加載如下:頁面索引不起作用

protected void Page_Load(object sender, EventArgs e) 
     { 
      if (!Page.IsPostBack) 
      { 
       CustomerView.DataSource = Customer.GetAll(); 
       CustomerView.DataBind(); 
      } 
     } 

protected void CustomerView_PageIndexChanging(object sender, System.Web.UI.WebControls.GridViewPageEventArgs e) 
     { 
      int newPageNumber = e.NewPageIndex + 1; 
      CustomerView.DataSource = Customer.GetAll(); 
      CustomerView.DataBind(); 
     } 

我是什麼在不工作做錯了我的網頁索引。

回答

0

試試這個。我認爲你必須手動設置GridView的PageIndex屬性。

protected void CustomerView_PageIndexChanging(object sender, System.Web.UI.WebControls.GridViewPageEventArgs e) 
{ 
    CustomerView.PageIndex = e.NewPageIndex; 
    CustomerView.DataSource = Customer.GetAll(); 
    CustomerView.DataBind(); 
}