如何使用DataList执行简单的分页操作。我不想去找CustomPaging。
有没有像我们在GridView中做分页这样的简单方法。我愿意使用DataPager控件
发布于 2011-11-25 21:45:20
最简单的方法可能是使用PagedDataSource
转发器的示例如下所示:Adding Paging Support to the Repeater or DataList with the PagedDataSource Class
// 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();https://stackoverflow.com/questions/8269923
复制相似问题