日期:2014-05-17  浏览次数:20489 次

为什么这段代码分不了页,这是用AspNetPager来给datalist分页的,
for (int i = 0; i < DataList1.Items.Count; i++)
  {
  HiddenField h = this.DataList1.Items[i].FindControl("Id") as HiddenField;
  DataSet dataset1 = BLL.hui(Int32.Parse(h.Value));
  PagedDataSource pdd = new PagedDataSource();
  pdd.DataSource = dataset1.Tables["s"].DefaultView;
  pdd.AllowPaging = true;
  pdd.PageSize = AspNetPager2.PageSize;
  AspNetPager2.RecordCount = pdd.PageCount;
  pdd.CurrentPageIndex = AspNetPager2.CurrentPageIndex - 1;
  DataList DataList_Content = this.DataList1.Items[i].FindControl("DataList2") as DataList;
  DataList_Content.DataSource = pdd;
  DataList_Content.DataBind();

  }
  protected void AspNetPager2_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  {
  AspNetPager2.CurrentPageIndex = e.NewPageIndex;
  fenye();
  }

------解决方案--------------------
protected void anp_PageChanged(object src, EventArgs e)
{
Rep_MessageBind();
}
------解决方案--------------------
亲 你不把关键的方法 fenye();贴出来,让我们在这里怎么帮你看分页的问题?