GridViewSortEventArgs::SortDirection Property
Updated: August 2008
Gets or sets the direction in which to sort the GridView control.
Assembly: System.Web (in System.Web.dll)
When the Sorting event is raised, you can use the SortDirection property to determine the order in which the GridView control will sort its items (based on the sort expression) when the sort operation is performed. Because the Sorting event occurs before the sort operation, you can also use the SortDirection property to programmatically set the sort direction.
Note: |
|---|
If you bind the GridView control to a data source by programmatically setting the DataSource property, the SortDirection property always returns SortDirection::Ascending. In this case, you must provide the sorting functionality in the event-handler method for the Sorting event. |
The following example demonstrates how to use the SortDirection property to determine the direction in which to sort a GridView control. If the user attempts to sort in descending order, the sort operation is canceled.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
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.
Note: