I'm developing a window application in C# VS2005. I have a dataGridView in which the first column has Checkboxes. Now i want the Column header also to be a CheckBox which if i select all the Checkboxex in the column should get selected. How can i do this.? I referred the Code Project link
But if i use that, if i click the FirstCell (not the Header) all the below cells are getting selected. But i want a CheckBox in the Column header. How can i do this.?
'Find the Location of Header Cell. 'Place the Header CheckBox in the Location of the Header Cell. 'Assign Click event to the Header CheckBox. 'Add a CheckBox Column to the DataGridView at the first position.
If you choose @Ehsan solution you must know that if the checkbox cell is selected it won't update the checkbox UI. You need to call RefreshEdit() afterwards.
It only happens when the control is child-control of the datagridview. For some reason when it is a child-control the selected cell checkboxes are not able to refresh the UI by their own.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With