ObjectContainerDataSource / FormView and Failed Business Object Validation

Topics: Web Client Software Factory
Apr 30, 2009 at 6:54 PM
The scenario is basically the idea that validation doesn't fail until you get to the business object and how to prevent the FormView from resetting itself.  In the case of a failed Update the original record is shown, in a case of a failed insert the field data is erased.  Solving this problem with an ObjectDataSource was straight forward by throwing an error and letting it bubble up then in FormView_ItemInserted event setting e.KeepInInsertMode (or KeepInUpdateMode) and e.ExceptionHandled to true (with a little checking to make sure it was a validation error of course). 

That method does not work with  ObjectContainerDataSource.  I am using MVP here and cannot use the validation block as my API layer is built using different technology.  I have tried re-populating the ObjectContainerDataSource.  Throwing the error doesn't work as the error is seen as an unhandled exception.  I messed with the KeepInInsertMode but if an error wasn't thrown so that doesn't work.

Any help would be appreciated.