This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I am not entirely sure if this is a .NET 4.0 issue, or if the issue also exists in .NET 3.5. But I have a simple ASP.NET page with a GridView on it. I set it to allow paging (AllowPaging="True") and take over the OnPageIndexChanging event to rebind the dataset. In the code behind I then simply bind the data using this example code: var result = UnitOfWork.Something.Where(s => s.IsActive); This simple code throws an "The data source does not support server-side data paging." exception. A work around (at the moment) is to do: Why is it throwing this error? |
|
|
Hi Jerremy, Please check out the sample here: http://www.mindscape.co.nz/forums/Post.aspx?ThreadID=2843&PostID=9117 This shows how to use LightSpeed with GridViews. The issue is because the LightSpeed entities need to implement an ObjectDataSource (which it doesn't by default). I'm surprised that it works with a .ToList() as I'm sure it didn't used to work, but perhaps .NET 4.0 now can apply LINQ-to-Objects on collections for paging etc. I hope that helps - let me know if you have any feedback. John-Daniel Trask |
|
|
Looks like a lot of work (adding a repository with functions for an ObjectDataSource) compared to just doing a GridView.DataSource = whatever. I'd sooner implement custom paging and just to a skip/take scenario (or even easier, use a telerik grid). What I dont get though is, TList<T> doesnt implement ObjectDataSource either: public class List<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable And paging works fine using .ToList(). I dont really care about the ObjectDataSource control, I just want to do it all using code behind :) |
|
|
Hi Jerremy, I think you'll find the reason it works on Lists is because Microsoft, in their tireless efforts towards demoware that you shouldn't use in production, so doing absolutely everything in memory. You'll find it performs well when you have a small dataset but then wonder why it performs like an absolute dog when you have 10,000 rows of data. Because the GridView doesn't know how to pass LINQ directly onto the objects collection in a manner that would have us pass it to the database then yes, it will fail. The work required to get it working with sorting, paging etc is a bit of a pain but you can consider it the effort required to ensure your application code performs well in production. It's fairly boiler plate code so you could probably copy and paste it from the sample I linked to :-) Ivan may have more to add to this as he has looked at the ObjectDataSource stuff with LightSpeed before and perhaps we could review it again once we ship 3.1. I hope that helps, John-Daniel Trask P.S. If you use a grid that supports dynamic LINQ (like the Telerik MVC Grid) then we do indeed work happily with that. LightSpeed can handle those queries and turn them into efficient database calls however I'm not sure if Teleriks standard ASP.NET DataGrid has that capability so you would need to check that. |
|