The title says it all. I've seen hints around the net that this is the case, but I can't find any official documentation to this effect. I want to be sure I have my facts straight before I utilize the LinqDataSource. Thanks guys.
+3
A:
Look at LinqDataSource.AutoPage
. You can set this using the following:
<asp:LinqDataSource
.
.
.
AutoPage="true"
.
.
.
runat="server">
</asp:LinqDataSource>
Note that, from the documentation, this property is true
by default:
true
if the user can page through the data; otherwise,false
. The default value istrue
.
Further:
When the
AutoPage
property is set totrue
, theLinqDataSource
control retrieves only enough records for one page in the data-bound control. It uses theSkip(TSource)
andTake(TSource)
methods to retrieve the records for the current page.
Jason
2010-01-03 00:19:57
Setting it to true will enable server-side paging, then?
Will
2010-01-03 00:21:36
Yes, and the default value is `true`.
Jason
2010-01-03 00:23:13
Do you happen to know if this plays nice with the Where property in the configuration designer for this datasource? It would be unfortunate for it to return one page of results, then filter them to nothing because none met the filter criteria. Does that make sense?
Will
2010-01-03 00:29:45
I understand your question to mean: if you use a `Where` (`<asp:LinqDataSource ... Where="some predicate" ... runat="server"></asp:LinqDataSource>`) is the filtering done on the server and then pages of the results returned? Yes.
Jason
2010-01-03 00:38:43
A:
No, it does not perform it by default, however it is very easy to implement with
.Skip(perPage*(page-1)).Take(perPage)
edit: Huh, i guess it actually does!
Paul Creasey
2010-01-03 00:21:14
A:
I would recommend using sql profiler to test the performance of your sql queries.
JustEngland
2010-01-03 18:13:07