开发者

Does LinqDataSource perform Server-Side paging by default?

开发者 https://www.devze.com 2022-12-15 12:53 出处:网络
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 L

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


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消