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: property String^ SortExpression { virtual String^ get(); virtual void set(String^ value); }
Property Value
Type: System::String^The 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.
Available since 1.1
