Does LinqDataSource perform Server-Side paging by default?
I've seen hints around the net that this is the case,开发者_如何学Python 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.
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.
I would recommend using sql profiler to test the performance of your sql queries.
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!
精彩评论