Gets or sets a value indicating whether the grid can be resorted by clicking on a column header.
[Visual Basic] Public Property AllowSorting As Boolean [C#] public bool AllowSorting {get; set;} [C++] public: __property bool get_AllowSorting(); public: __property void set_AllowSorting(bool); [JScript] public function get AllowSorting() : Boolean; public function set AllowSorting(Boolean);
true if columns can be resorted by clicking a column header; otherwise, false.
You can also sort using an expression for a DataColumn. See Expression for details on creating a sort expression.
The following example toggles the AllowSorting property.
[Visual Basic]
Private Sub AllowSorting() ' Toggle the AllowSorting property. DataGrid1.AllowSorting = DataGrid1.AllowSorting Xor True End Sub
DataGrid Class | DataGrid Members | System.WinForms Namespace | Expression | Sort | Sort