Gets or sets the fields that are used for ordering grouped data.
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
You use the property to specify how the groups of data are sorted. For example, you can group by the CategoryID property and then sort each category ID group by the average of the Price property.
The property that is used to sort the data must be either a property that is used to group the data, or the result of an aggregation function on the grouped data. To specify how the data is sorted, you can add a space and the string "Ascending", "ASC", "Descending", or "DESC" to a property name in the string.
You can specify more than one property in the property. Separate each property by using a comma.
The following example shows how to group the data by using two properties, and how to sort the grouped data by using one of those properties. The data from a table named Products is grouped by using properties named CategoryID and Discontinued. The grouped data is sorted by the CategoryID property.
<asp:LinqDataSource ContextTypeName="DataClassesDataContext" TableName="Products" GroupBy="new (CategoryID, Discontinued)" OrderGroupsBy="Key.CategoryID" Select="new(Key.CategoryID, Key.Discontinued, Average(UnitPrice) As AvePrice)" ID="LinqDataSource1" runat="server" > </asp:LinqDataSource>
The following example shows how to group the data by using a property, and how to sort it based on the results of an aggregation function. The data from the Products table is grouped by using the CategoryID property. It is sorted based on the average of the UnitPrice property within each group.
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.