AspNetPager有分页,但点下一页就显示无数据

wolfpp wolfpp 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
求助!
用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();
}

急等,感谢!
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
wolfpp
.NET社区 62,275 成员 668,968 内容