Reputation: 209
I am currently using a datagridview in C# that is working correctly.
This datagridview has a checkbox field thats linked too a database, I am requiring all rows in the datagridview to be red until the checkbox is checked. Once the checkbox is checked the row will then turn green.
I am also requiring the checkbox field to be the only field in the datagrid that is not read only, but this isnt crucial at this stage. I hope you can offer me some suggestions.
Using visual studio 2010 in a windows forms application
Upvotes: 0
Views: 1048
Reputation: 6651
Refer to CellContentClick event.
Read the cell value when user clicks it. If the checkbox is set then get the row index from event handler and write the following line in event handler.
datagrid.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Green;
Upvotes: 1