I have a situation in which a user can click a row and change data for that row, which will change a Boolean indicating the code has been changed. Then when the user clicks a new row, the click event should check to see if CodeChanged = true, if so, then a messagebox will pop-up asking the user if they would like to save unsaved data. If they click yes then the click event should be cancelled and the previously selected row should stay selected. What is the best way to go about doing this?
Hello Devin,
Thank you for the detailed description. Based on it I managed to create a simple sample reproducing your scenario.
In order to prevent the current row to be unselected due to some actions you could use BeforeRowDeactivete event, as Mike suggested. By using the Cancel property of the CancelEventArgs you could prevent the active row to be deactivated. Thus you could achieve the desired functionality instead of using the Click event.
I’ve implemented this suggestion in a simple sample, and you could run and evaluate it, please see attached zip.
Please let me know if you have any further questions.
Hello Atanas,
This does cancel the row change when the user responds yes. However, if the user clicks no, it should trigger the cell click event (but it is not). My cell click event will change labels on the form based on the currently selected row and set other properties, but since it is not being triggered none of this is updated. How can I handle both of these cases?
Thanks,
Devin
I am just checking about the progress of this issue. Let me know If you need my further assistance on this issue?
Thank you for using Infragistics Components.
Based on the provided description I have modified my sample in order to reproduce your scenario. I have managed to fire the ClickCell event and in it I call a method that does all the functionality expected from the ClickCell event. You could call this method instead of trying to trigger a ClickEvent to re-click. The main functionality of the method is to check if you have clicked ‘No’ in the message box and if so some labels of the form are changed based on the currently selected row.
I’ve implemented this suggestion in the sample, and you could run and evaluate it, please see attached zip.
If I stored the index of the currently selected row and then checked for unsaved data in the CellClick event, could I trigger a click event to re-click the last row using the stored index?