I have a GridDataBoundGrid, I set grid.Model.ReadOnly = true when I initialize the grid because I don''t allow user to edit for most of the columns. However in some cells, I do need user input based on those cells'' values. So I need to set those cells'' ReadOnly property false. What I did is:
for(int i = 0; i < grid.Model.RowCount; i++)
grid.Model.IgnoreReadOnly = true;
grid[i, 2].ReadOnly = false;
grid.Model.IgnoreReadOnly = false;
Above code doesn''t work. All of the grid is still ReadOnly. Any suggestion?
ADAdministrator Syncfusion Team November 12, 2004 08:59 AM
If you want a whole column to not be ReadOnly, then you can set the GridBoundColumn.ReadOnly = false for that column using either the grid.GridBoundColumns (if you populated this collection) or grid.Binder.InternalColumns (if you did not populate the grid.GridBoundColumns collection).
But if you want to set a property (other than style.CellValue or style.Text) only on some cells in a column, then you have to do it dynamically handling an event through either grid.PrepareViewStyleInfo or grid.model.QueryCellInfo. You use PrepareViewStyleInfo for properties used in drawing the cell like style.BackColor. You need to use Model.QueryCellInfo for functional properties like ReadOnly.
Here are two KBs on this process. The second one shows how to use Model.QueryCellInfo to set ReadOnly = true for a cell. You could set it to false that way as well.