Basics:
LLBLGen version 2.0.07.0424, C#, .net 2.0, Adapter
We've run into some complications using Adapter, GridViews and LLBLGenProdDataSource2 with live persistence set to false.
What we want to do is validate the changes made to an entity in the GridView using a business object.
In the LLBLGenProDataSource2 PerformWork event handler, we create a business object and if it fails validation, append an error message to the validation summary. The problem with doing this is that the GridView re-binds itself, and the data the user entered is gone. Is there a way to "cancel" the PerformWork event?
Alternatively, I tried doing the validation in the GridView's RowUpdating event, but, at that point the datasource doesn't have any of the changes that were made by the user. The RowUpdating event args does have a NewValues dictionary, but stuffing those values into an entity doesn't appear to be straightforward.
The current solution we have is to create asp.net validators that fire and prevent the GridView's RowUpdating event from firing, since the page isn't valid. An alternative, which I'm not fond of, is to throw an exception in the PerformWork event handler.
Do you all have any suggestions for handling validation with GridViews and the LLBLGenProDataSource2 classes?
Thanks.