I have a GridView on my screen and need it to allow paging.
Markup:
I've changed my code to this:
public List<string> ListofNewsTitle()
{
var query = from n in db.NewsEvents
orderby n.NewsDate descending
select n.NewsTitle;
return query.ToList();
}
A simple ToList()
on your result var should work.
Edit:
As explained in comments below my answer, the reason for the error is that the data source should implement ICollection. IEnumerable does not, when you do ToList()
it converts it into a list which implements ICollection.