DataGridColumn::SortExpression Property
Gets or sets the name of the field or expression to pass to the OnSortCommand method when a column is selected for sorting.
Assembly: System.Web (in System.Web.dll)
public: virtual property String^ SortExpression { String^ get (); void set (String^ value); }
Property Value
Type: System::StringThe name of the field to pass to OnSortCommand when a column is selected for sorting. The default value is String::Empty.
Use the SortExpression property to specify or determine the name of the field to pass to the OnSortCommand method when a column is selected for sorting.
Note |
|---|
This property does not bind the column to a field in data source. To bind a column to a field, see the documentation for the specific column type. |
When sorting is enabled, LinkButton controls are rendered in the heading section of each column where the SortExpression property is set.
Note |
|---|
When the AutoGenerateColumns property is set to true, the SortExpression property for each column in the DataGrid control that supports data binding is automatically set with the field name bound to the column. If the AutoGenerateColumns property is set to false, you need to manually set the SortExpression property with the field name bound to the column for each column that you want to enable sorting for. |
These LinkButton controls allow you to sort the DataGrid control by the selected column. When a LinkButton control for a column is clicked, the SortCommand event is raised. The value of the SortExpression property for the selected column is passed to the OnSortCommand event handler as part of the DataGridSortCommandEventArgs object.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note