System.Windows.Forms.DataGridViewColumn.SortMode Property

Gets or sets the sort mode for the column.

Syntax

[System.ComponentModel.DefaultValue(System.Windows.Forms.DataGridViewColumnSortMode.NotSortable)]
public DataGridViewColumnSortMode SortMode { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

When a System.Windows.Forms.DataGridView control is sorted using a column with a DataGridViewColumn.SortMode property value of DataGridViewColumnSortMode.Automatic, a sorting glyph is automatically displayed in the column header.

When the control is sorted using a column with a DataGridViewColumn.SortMode property value of DataGridViewColumnSortMode.Programmatic, you must display the sorting glyph yourself through the DataGridViewColumnHeaderCell.SortGlyphDirection property.

The default sort mode of a System.Windows.Forms.DataGridViewTextBoxColumn is DataGridViewColumnSortMode.Automatic. The default sort mode for other column types is DataGridViewColumnSortMode.NotSortable.

The DataGridViewColumn.SortMode value does not prevent you from sorting a column programmatically, although other restrictions may apply. For more information, see the erload:System.Windows.Forms.DataGridView.Sort method.

A DataGridViewColumn.SortMode property value of DataGridViewColumnSortMode.NotSortable will not prevent the DataGridView.ColumnHeaderMouseClick event from occurring, but it will prevent the header from changing its appearance when it is clicked.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0