Make column non-selectable in FlexGrid

Posted by: daniel.koffler on 28 April 2023, 8:11 pm EST

  • Posted 28 April 2023, 8:11 pm EST


    I am using “OnSelectionChanging” from “GridCellFactory” to make a certain column non-selectable.

    However if using the arrow keys to change the selected cell indeed the respective cell/column is not selectable but also I want the column right next to non-selectable column selected immediately. (the non-selectable column should just be skipped) To achieve this I have to press the right-arrow key once again.

    If the non-selectable column is the last column in the grid and one tries to select it with the keyboard, nothing should happen and the current cell/column should stay selected.

    How can I fulfil this requirement?

    Please find my example app enclosed. Column “3” is the non-selectable column.

    Thank you

  • Posted 2 May 2023, 12:03 am EST

    Hi Daniel,

    Please update the OnSelectionChanging event as follows:

     protected override void OnSelectionChanging(GridControlSelectionEventArgs e)
                if (e.CellRanges[0].Column == 6)
                    e.Cancel = true;
                    if (e.CellRanges[0].Column != Grid.Columns.Count) 
                        var selection = Grid.Selection;
                        selection.Column = selection.Column + 2;
                        Grid.Selection = selection;
                        Grid.SetCursor(selection.Row, selection.Column);

    This code would work fine as per your request but if the last column is Non-selectable. The next row’s first cell can be selected by pressing the Tab key but the selection would be prevented for the Right arrow key.

    Hope it helps!


    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels