AspNetPager有分页,但点下一页就显示无数据
求助!
用AspNetPager做分页,一页显示10条,特意增加了11条数据,能正确显示2页,但点下一页竟然没有数据!请问怎么解决?
代码:
public void Bind()
{
if (string.IsNullOrEmpty(_subNum))
{
_subNum = "10";
}
ds = manage.GetNewsListByName(_channelName,_parentName);
AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
AspNetPager1.PageSize = 3;
PagedDataSource pds = new PagedDataSource();
pds.DataSource = ds.Tables[0].DefaultView;
pds.AllowPaging = true;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.PageSize = AspNetPager1.PageSize;
GvList.DataSource = pds;
GvList.DataBind();
//Response.Write("<script>alert('"+AspNetPager1.RecordCount.ToString()+"');</script>");
if (ds.Tables[0].Rows.Count > 0)
{
AspNetPager1.Visible = true;
}
else
{
AspNetPager1.Visible = false;
}
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
Bind();
}
急等,感谢!
------解决方案--------------------