LinqDataSource.AutoPage Property

Gets or sets a value that indicates whether the LinqDataSource control supports navigation through sections of the data at run time.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

public bool AutoPage { get; set; }
<asp:LinqDataSource AutoPage="True|False" />

Property Value

Type: System.Boolean
true if the user can page through the data; otherwise, false. The default value is true.

Set the AutoPage property to true to enable paging in the LinqDataSource control. To enable the user to page through the data, connect a data-bound control that provides the interface for paging to the LinqDataSource control. 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.

The following example shows a LinqDataSource control with the AutoPage property set to true and a GridView control that is bound to the LinqDataSource control. The AllowPaging property of the GridView control is set to true to provide the interface that lets users page through the data.

<asp:LinqDataSource 
    ContextTypeName="ExampleDataContext" 
    TableName="Products" 
    AutoPage="true"
    AutoSort="true"
    ID="LinqDataSource1" 
    runat="server">
</asp:LinqDataSource>
<asp:GridView 
    AllowPaging="true"
    AllowSorting="true"
    DataSourceID="LinqDataSource1"
    ID="GridView1" 
    runat="server">
</asp:GridView>

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft