Search code examples
sqlasp.netlinqlistviewpagination

LINQ and paging with a listview


I have a page with a listview control and a datapager control. The listviews datasource is set programatically using this code:

Dim dal as new dalDataContext
Dim bookmarks = From data In dal.getData(userid)
listview1.DataSource = bookmarks
listview1.DataBind()

When i test this page in a browser it comes up with the error: 'ListView with id 'listview1' must have a data source that either implements ICollection or can perform data source paging if AllowPaging is true.'

How can i implement paging in this scenario?

Thanks


Solution

  • Try

    listview1.DataSource = bookmarks.ToArray()
    

    I had the same problem this week.