System.Web.UI.WebControls.GridView.Sort Method

Sorts the System.Web.UI.WebControls.GridView control based on the specified sort expression and direction.

Syntax

public virtual void Sort (string newSortExpression, SortDirection newSortDirection)

Parameters

newSortExpression
Documentation for this section has not yet been entered.
newSortDirection
Documentation for this section has not yet been entered.

Remarks

Use the GridView.Sort(string, SortDirection) method to programmatically sort the System.Web.UI.WebControls.GridView control using the specified sort expression and direction. The sort expression specifies the column or columns with which to sort. To sort multiple columns, create a sort expression that contains a comma-separated list of field names. The sort direction indicates whether sorting is performed in ascending or descending order. This method is commonly used when you need to sort the System.Web.UI.WebControls.GridView control from outside of the control, such as from a different control on the page. This method is also commonly used to programmatically set a default sort order for the System.Web.UI.WebControls.GridView control when it is first rendered. Calling this method also raises the GridView.Sorted and GridView.Sorting events.

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0