Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"The data source does not support server-side data paging" when using a front-end collection

I currently have a repeater whose datasource is a List where ModelObject is a custom class in the front-end used to help render the more complex LINQ to SQL object. For example, it renders URLS for links, names of statuses, etc.. The status names are not in the database because we knew we'd have to localize this app someday.

Now I need to page and sort this list so I'm trying to switch to a gridview to take advantage of the out of the box functionality. I get the error "The data source does not support server-side data paging". What kind of datasource can I use that will still allow my front-end to customize the output? This seems it should be a common task because apps that are localized need the sort values coming out of the resx files.

Thanks for your help.

like image 464
Mark Melville Avatar asked Aug 14 '09 02:08

Mark Melville


2 Answers

You can't use an IQueryable object to data bind to a GridView and still use Paging and Sorting. You must return a List to the GridView using the ToList() method.

See this DevToolShed Article for more information:
http://www.devtoolshed.com/content/gridview-objectdatasource-linq-paging-and-sorting

like image 83
Robert Harvey Avatar answered Nov 11 '22 17:11

Robert Harvey


For those that are getting this error but implementing:

IEnumerable<T> or 
IEnumerable or 
IList<T> or 
IDictionary<T1, T2>.

You need to implement ICollection (the non-generic one) for you to get passed the "The data source does not support server-side data paging" error.

like image 29
jafesler Avatar answered Nov 11 '22 17:11

jafesler