首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >与GridView中一样,数据列表中的简单分页-而不是自定义分页

与GridView中一样,数据列表中的简单分页-而不是自定义分页
EN

Stack Overflow用户
提问于 2011-11-25 21:35:38
回答 1查看 3.6K关注 0票数 0

如何使用DataList执行简单的分页操作。我不想去找CustomPaging

有没有像我们在GridView中做分页这样的简单方法。我愿意使用DataPager控件

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-11-25 21:45:20

最简单的方法可能是使用PagedDataSource

转发器的示例如下所示:Adding Paging Support to the Repeater or DataList with the PagedDataSource Class

代码语言:javascript
复制
// Populate the repeater control with the Items DataSet
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = Items.Tables[0].DefaultView;

// Indicate that the data should be paged
objPds.AllowPaging = true;

// Set the number of items you wish to display per page
objPds.PageSize = 3;

// Set the PagedDataSource's current page
objPds.CurrentPageIndex = CurrentPage - 1;

repeaterItems.DataSource = objPds;
repeaterItems.DataBind();
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8269923

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档