ComponentOne FlexGrid for WinForms
Restricting Sorting for a Specific Column
FlexGrid for WinForms Task-Based Help > Restricting Sorting for a Specific Column

To restrict sorting for a specific column, set the AllowSorting property to False either in the designer or in code.

In the Designer

  1. Select the column in the grid that you would like to edit. This will open the Column Tasks menu for that column.
  2. Uncheck the Allow Sorting check box.

Alternatively, the AllowSorting property can be set using the C1FlexGrid Column Editor:

  1. Open the C1FlexGrid Column Editor. For details on how to access the C1FlexGrid Column Editor, see Accessing the C1FlexGrid Column Editor.
  2. Select the column that you would like to edit from the right pane and set the AllowSorting property to False in the left pane.
  3. Click OK to close the editor.

In Code

Add the following code to the Form_Load event to restrict sorting the AtomicNumber column:

To write code in Visual Basic

Visual Basic
Copy Code
Me.C1FlexGrid1.Cols("AtomicNumber").AllowSorting = False
' Is the same as: Me.C1FlexGrid1.Cols(1).AllowEditing = False

To write code in C#

C#
Copy Code
this.c1FlexGrid1.Cols["AtomicNumber"].AllowSorting = false;
// Is the same as: this.c1FlexGrid1.Cols[1].AllowEditing = false;
See Also