Category / Section
How do I prevent sorting by columns?
1 min read
While clicking on the column header, the Grid control get sorted automatically. To avoid this in GridGroupingControl the AllowSortColumns property has to be set as 'false', in GridDataBoundGrid the SortBehaviour property has to be set as 'None'. Please refer the below code snippets for both GridGroupingControl and GridDataBoundGrid:
GridGroupingControl:
C#
this.gridGroupingControl1.TableOptions.AllowSortColumns = false;
GridDataBoundGrid:
C#
this.gridDataBoundGrid1.SortBehavior = GridSortBehavior.None;
GridGroupingControl:
VB
Me.gridGroupingControl1.TableOptions.AllowSortColumns = False
GridDataBoundGrid:
VB
Me.gridDataBoundGrid1.SortBehavior = GridSortBehavior.None