I've just modified some of my code to use a generic list and seems to have worked fine, hope this helps:
Note that this entire method can be called with or without a page number to automatically set the page, it also builds a paging control inside of a panel calling PagingPanel.
The line that sets the DataSource on the PagedDataSource instance (dataSource) did take an array of NewsItems (searchResults), I've updated it to consume a List that's created using the NewItem array.
void PopulateNewsItems (int? pageNo)
{
var model = ModelFactory.GetNewsModel ();
var searchResults = model.GetNewsItems ();
var dataSource = new PagedDataSource ();
// CHANGED THE ARRAY OF NEWSITEMS INTO A GENERIC LIST OF NEWSITEMS.
dataSource.DataSource = new List<NewsItem> (searchResults);
dataSource.AllowPaging = true;
var pageSizeFromConfig = ConfigurationManager.AppSettings["NewsItemsPageCount"];
var pageSize = 10;
int.TryParse (pageSizeFromConfig, out pageSize);
dataSource.PageSize = pageSize;
dataSource.CurrentPageIndex = pageNo ?? 0;
PagingPanel.Controls.Clear ();
for (var i = 0; i < dataSource.PageCount; i++)
{
var linkButton = new LinkButton ();
linkButton.CommandArgument = i.ToString ();
linkButton.CommandName = "PageNo";
linkButton.Command += NavigationCommand;
linkButton.ID = string.Format ("PageNo{0}LinkButton", i);
if (pageNo == i || (pageNo == null && i == 0))
{
linkButton.Enabled = false;
linkButton.CssClass = "SelectedPageLink";
}
linkButton.Text = (i + 1).ToString ();
PagingPanel.Controls.Add (linkButton);
if (i < (dataSource.PageCount - 1))
PagingPanel.Controls.Add (new LiteralControl ("|"));
}
NewsRepeater.DataSource = dataSource;
NewsRepeater.DataBind ();
}
void NavigationCommand (object sender, CommandEventArgs e)
{
PopulateNewsItems (int.Parse ((string)e.CommandArgument));
}