簡體   English   中英

與GridView中一樣,在數據列表中進行簡單分頁-不自定義分頁

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

如何使用DataList進行簡單分頁。 我不想去CustomPaging

有沒有像在GridView進行分頁一樣簡單的方法。 我願意使用DataPager comtrol

最簡單的方法可能是使用PagedDataSource

這里顯示了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();

使用分頁數據可簡化其操作。此鏈接可能會有所幫助

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM