DataGridViewButtonColumn disable particular ButtonCells

0
0

I’m trying to disable particular ButtonCells in DataGridView.
The following doesn’t work.


foreach (var row in dataGrid.Rows)
{
((DataGridViewButtonCell) row.Cells["ColumnX"]).State = DataGridViewElementStates.ReadOnly;
((DataGridViewButtonCell) row.Cells["ColumnX"]).ReadOnly = true;
}

 

Best regards

Corvin

  • You must to post comments
0
0

Hi Corvin,

we looked at it and from what we found ReadOnly is not the same as Disabled.
The DataGridView does not have the Disabled property for button or linked cells.

So you could either create a custom column/cell that adds the Disabled property
or simply ignore the click when ReadOnly = true.

We´ll add the Disabled property as enhancement request WJ-8689.

Best regards
Frank

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.