2011-11-25 40 views

回答

2

簡單的方法可能使用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();