Gets or sets a value that indicates whether the LinqDataSource control supports sorting the data at run time.
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
Set the property to true to enable sorting in a LinqDataSource control that is based on the sort expression from a data-bound control. The data-bound control provides the interface to enable the user to select at run time which property to use for sorting.
You can programmatically set the order in which data is returned by setting the OrderBy property to the property or properties used for sorting. When the OrderBy property is set to a property and the property is true, the sort expression from the data-bound control is applied after the expression in the OrderBy property. Therefore, this determines the final sorting of the data.
The following example shows a LinqDataSource control with the property set to true and a GridView control that is bound to the LinqDataSource control. The AllowSorting property of the GridView control is set to true to provide the interface that lets users sort 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>
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.