Highlight row in disabled grid

Thread ID:

Created:

Updated:

Platform:

Replies:

I'm using your GridControl to show a simple list of objects and I want to highlight the selected row. But I don't want the user to edit in this grid, so I set the Enabled = false for all the cells. If I only set ReadOnly = true, the user can still click in a cell and mark text. I don't want this behaviour.

This information helps. So by setting Enabled = false for the whole table, and setting the SelectionMode to One, the grid looks and behaves the way I want.

But since all cells are disabled, I can't use .CurrentCell. What is the best way to find the row that is selected. It looks like I can find the information under GridControl.Model.SelectedRanges. Is that what I should use?

Well I use the CellClick event, and there I can use the e.RowIndex to find the row clicked. This works even if all the cells are disabled. The problem however is when the user clicks a button outside the grid to edit the selected record. Then I want to find the selected row.

In both GridControl and GridDataBoundGrid classes, there is a member Selections which you can use to access exactly what cells are selected in the grid. This Selections class has a GetSelectedRows method that returns an array of ranges that are selected row ranges. You can iterate through this array to get all the ranges. So, to get the row index of this selected row , you can use code such as: