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
405
BeforeExitEditMode and CellClickButton advice
posted

Hello, I'm wondering what your thoughts are on this situation:

I have a grid that has an "Add New Row" button... all this does is add another object to the bindinglist that the grid is using as a datasource, so immediately the row shows up and I put the cursor in the first cell of the new row in edit mode for their convenience.  I'm using the initializelayout event to add an unbound column called 'Action' that has a delete button in it.  I'm handling the CellClickButton to delete rows from the underlying bindinglist.

I'm also using BeforeExitEditMode to determine if the user has entered valid values.  if they leave a required field blank, I ask them if they are sure and if so, to click 'OK', which will remove the underlying object from the bindinglist, which remoes the row from the grid.

The problem situation is... if they add a new row and before entering any data, the cursor goes to the first cell of the empty row, but they click the "Delete" button for that row... my BeforeExitEditMode event fires, as expected because the cursor left the first cell... it then prompts them if they are ok with removing the row, and if you click yes, it removes the row and then crashes... presumably because the CellClickEvent then fires, but is invalid because the object doesn't exist anymore.

What are your thoughts on this situation?  I may need to cancel the CellClickButton event somehow... but not sure how to do that. 

Thanks

Rocky

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi Rocky,

    Is the event actually firing? If so, then you could check to see if the row exists. If it's not actually firing, then there's really not much you can do about that - although I would consider this in a bug in the grid.

    If the event is not firing, and you therefore cannot trap the error, I'd recommend getting the latest service release. Perhaps the issue is already fixed.

    How to get the latest service release - Infragistics Community

    If that doesn't help, then the next step would be to try it in the latest version of the controls. No more updates are being made to v6.2, but you could download a trial version of the latest (v9.2) and see if the problem has been fixed.

    If it's still not fixed in v9.2, then the next step is for us to try to reproduce the crash and get it fixed.

Children