Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
765
How to determine cell clicked in wingrid?
posted

I have a Windows form with two wingrids.  The first wingrid displays a hierarchy - parent band consists of box(s) and the child band consists of files in those boxes.  The second wingrid displays a "flat" (no hierarchy) list of records.  In the first grid, I display a "Select" checkbox in the box rows.  In the second grid, I display a "Select" checkbox in each row.  What is the proper way to determine if the user actually clicked the "Select" checkbox (in either grid)?  I am trying to use the Grid_Click event and am getting a Nullreference exception if I click the Expansion Indicator, for example.  I need a way to grab the clickable cell/item within the grid and decipher if it's the specific "Select" checkbox cell in the row.  I seem to also have some undesirable behavior, since my first row in the grids are "selected"/active, even if I click the Expansion Indicator, the row becomes "selected" which is not what I want.  I want the user to actually click the "Select" checkbox. 

Thank you,

Chris

 

 

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Chris,

    Use the CellChange event of the grid. But note that you cannot use the cell's Value in this event, because the Value will not be updated until you leave the cell. So you have to use the Text property of the cell and convert the string to a boolean. You can use Boolean.Parse to make this easy. 

     

Reply Children
No Data