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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14700 |

    The first column in my grid is a checkbox for all rows and I need to provide “Select All” and “Select None” buttons. Has onyone done this? I’m not able to get the CellEditor to alter the state of the checkboxes.

    Thanks

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

    User (Old forums)
    Member
    Post count: 23064

    Which version of the grid are you using?

    Can you provide a piece of code on how you do things?

    Imported from legacy forums. Posted by André (had 222 views)

    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)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.