I tried
try
{
Template.Close(true);
}
catch
// Handle Exception which it never hits
I also tried
Grid.UpdateData
// again not hit
I have a dataset associated to the grid and as soon the Grid.UpdateData (or Template.Close(true) causes the grid to do an UpdateData to the datasource) it gives an error which does not appear to be trappable through try catch block. The problem is the data in the RowEdit Template is invalid and causes a constraint violation. I am not concerned about the violation, I want to catch the violation and handle it on the template close gracefully. Is there a way of knowing before a template close or updatedata that there is a violation or capturing the violation?
Hi,
The error is most likely being caught by the grid and raised to you as an event.
Try handling the Error and/or CellDataError event of the grid and see if they fire when the error occurs.
Run app and enter say ABC on consecutive rows to create a unique key violation.
Before calling ultraGridRowEditTemplate1.Close(true); - I would like to see if it is going to cause an error or to trap the error on the call.
What is best way of trapping the error (ideally would like to pre-test the close and if in error - display the error and then cancel the close)?