System.Windows.Forms.DataGrid.AllowSorting Property

Gets or sets a value indicating whether the grid can be resorted by clicking on a column header.

Syntax

[System.ComponentModel.DefaultValue(true)]
public bool AllowSorting { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

This property is overridden by the DataGridTableStyle.AllowSorting property if there is a System.Windows.Forms.DataGridTableStyle currently in effect for the control.

If sorting is allowed, clicking on a column header will sort the table data by that column.

You can also sort using an expression for a System.Data.DataColumn. See System.Data.DataColumn.Expression for details on creating a sort expression.

If the System.Windows.Forms.DataGrid is bound to a System.Data.DataView, you can set a custom sort for the table using the System.Data.DataView class's System.Data.DataView.Sort property. Similarly, if the System.Windows.Forms.DataGrid is bound to a System.Data.DataViewManager, each table in the System.Data.DataViewManager can have a custom sort by setting the System.Data.DataViewManager.DataViewSettings class's System.Data.DataViewSetting.Sort property.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0