AspNetPager控件问题

njxiaoxiong 2010-05-18 10:38:55
IList<MyNote> list = MyNoteManager.GetAllMyNoteByUserId(((Session["CurrentUser"]) as UserInfo).UserId);

PagedDataSource pdsList = new PagedDataSource();
pdsList.DataSource = list;
pdsList.AllowServerPaging = true;
pdsList.PageSize = this.anpList.PageSize;//anpLis是tAspNetPage的id
pdsList.CurrentPageIndex = anpList.CurrentPageIndex - 1;
this.anpList.RecordCount = MyNoteManager.GetAllMyNoteByUserId(((Session["CurrentUser"]) as UserInfo).UserId).Count;//调试的时候有数据的
this.dlMyNote.DataSource = pdsList;
this.dlMyNote.DataBind();


在页面显示的时候aspnetpage 控件运用后可以分页 但是下一页之后数据还是和前一页相同


这是怎么回事?????
...全文
83 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
aluogang 2010-05-18
  • 打赏
  • 举报
回复
http://www.webdiyer.com/Controls/AspNetPager/SourceCode/AspNetPager
njxiaoxiong 2010-05-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 skyqingtian 的回复:]
设定状态保持对象ViewState
[/Quote] 怎么简单法 请指教???
njxiaoxiong 2010-05-18
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 lyvscf 的回复:]
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
你上面的是方法
}
[/Quote] 是PageChanged事件 我怎么记得是aspNote_PageChanging事件呢 我写得是aspNote_PageChanging事件
lyvscf 2010-05-18
  • 打赏
  • 举报
回复
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
你上面的是方法
}
imfor 2010-05-18
  • 打赏
  • 举报
回复
写的太臃肿了,先看看例子,分页加绑定数据三行代码就可以了
skyqingtian 2010-05-18
  • 打赏
  • 举报
回复
设定状态保持对象ViewState

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧