ערוך

שתף באמצעות


LinqDataSource.AutoPage Property

Definition

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

public:
 property bool AutoPage { bool get(); void set(bool value); };
public bool AutoPage { get; set; }
member this.AutoPage : bool with get, set
Public Property AutoPage As Boolean

Property Value

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

Examples

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

Remarks

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 and Take methods to retrieve the records for the current page.

Applies to