Home Forums WinForms controls Xceed Grid for WinForms Interacting with a checkbox programmatically Reply To: Interacting with a checkbox programmatically

User (Old forums)
Member
Post count: 23064

I was able to work through this one and get it working.
I had been trying to use the GridEditor to select the check box because I could see that my OnClick override was working properly. Instead, to get it working, all I needed to do was cycle through each datarow in my grid – and then check for null (not DBNull.Value) on the particular column before determining if it was true or false.

Here’s the method:

private void SelectAllRows() {
int selIndx;
foreach(Xceed.Grid.DataRow dRow in gridWorkList.DataRows) {
selIndx = dRow.Cells.IndexOf(“Sel”);
if(dRow.Cells[selIndx].Value == null || Convert.ToBoolean(dRow.Cells[selIndx].Value) == false) {
dRow.Cells[selIndx].Value = true;
}
}
}

Imported from legacy forums. Posted by dlrjones (had 3395 views)