views:

143

answers:

3

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 is true.

Further:

When the AutoPage property is set to true, the LinqDataSource control retrieves only enough records for one page in the data-bound control. It uses the Skip(TSource) and Take(TSource) methods to retrieve the records for the current page.

Jason
Setting it to true will enable server-side paging, then?
Will
Yes, and the default value is `true`.
Jason
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
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
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
A: 

I would recommend using sql profiler to test the performance of your sql queries.

JustEngland