The data source does not support server-side data paging

后端 未结 8 1174
眼角桃花
眼角桃花 2020-11-29 07:20

I have a GridView on my screen and need it to allow paging.

Markup:



        
相关标签:
8条回答
  • 2020-11-29 07:51

    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();        
    }
    
    0 讨论(0)
  • 2020-11-29 07:52

    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.

    0 讨论(0)
提交回复
热议问题