2011-11-25 68 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();