I have a datagridview on a form with some data. The 1st column contains button for deleting the row. How can we disable this button or the entire row based on some condition, so the row cannot be deleted?
Winforms – Datagridview, disable button/row
buttondatagridviewdelete-rowwinforms
Related Topic
- Html – How to create an HTML button that acts like a link
- C# – How to handle click event in Button Column in Datagridview
- C# – How to disable the last blank line in DatagridView
- C# – How to remove the empty row from the bottom of a DataGridView control
- C# – Datagridview full row selection but get single cell value
- Javascript – Disable form auto submit on button click
- C# – How to disable particular check box cell in a DataGridView CheckBox column
- Angularjs – Disable submit button when form invalid with AngularJS
Best Answer
Would you consider just turning the button cell into a regular empty text box disabled?
It loses its bordered "Button" appearance and blends in with the remainder of the cells (assuming you are using primarily the default DataGridViewTextBoxCells).
Here's the equivalent in C#, plus it grays out the field to make it look read-only: