简体   繁体   English

与GridView中一样,在数据列表中进行简单分页-不自定义分页

[英]Simple Paging in datalist as in GridView - NOT CUSTOM PAGING

How can I do simple paging with DataList . 如何使用DataList进行简单分页。 I don't want to go for CustomPaging . 我不想去CustomPaging

Is there any simple methods like we do Paging in GridView . 有没有像在GridView进行分页一样简单的方法。 I am willing to using DataPager comtrol 我愿意使用DataPager comtrol

Simplest way is probably to use the PagedDataSource 最简单的方法可能是使用PagedDataSource

an example with Repeater is shown here: Adding Paging Support to the Repeater or DataList with the PagedDataSource Class 这里显示了Repeater的示例: 使用PagedDataSource类将寻呼支持添加到Repeater或DataList中

// 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();

go for paged datasouce its simple .this link may help 使用分页数据可简化其操作。此链接可能会有所帮助

http://www.codeproject.com/KB/aspnet/pagingBySreejith%20Thathanattu.aspx http://www.codeproject.com/KB/aspnet/pagingBySreejith%20Thathanattu.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM