This tutorial will demonstrate how to use the SortDirection enumeration in ASP.NET and VB.NET 2.0 to determine the direction of items displayed by GridView control.

The SortDirection enumeration is used to represent the direction in which items are sorted.It is commonly used by properties (such as the SortDirection property of the GridView class) to indicate the order in which items are displayed in a control.

The following code example demonstrates how to use the SortDirection enumeration to determine the direction in which the GridView control is displaying its items. The MS sample database of Northwind is required for this sample.

First, you will need to import the System.Web.UI.WebControls namespace

The SortDirection.aspx page looks something like this:

Download Source Files