Displaying a confirmation message after the object is saved successfully

Displaying a confirmation message after the object is saved successfully

Old forum URL: forums.lhotka.net/forums/t/6104.aspx


basile posted on Thursday, January 08, 2009

We need to display a confirmation message to the user after the object has been saved successfully. The way we have it setup currently is within the CslaDataProvider.DataChanged event handler we get the business object using dp.Data and attach an event handler to its Saved event. It used to work fine prior to upgrading to version 3.6, but now the event is no longer been raised. The reason for that is because after the DataPortal operation we get a new object back and the updated object no longer has the Saved event handler attached to it... Does anyone have any suggestions how to make it work with CSLA 3.6?

Thanks!

rsbaker0 replied on Thursday, January 08, 2009

What version did you move from?

In CSLA 3.5, OnSaved() is invoked on the *original* object, passing the new object later returned from Save() as it's parameter.

So, I'd think it should work at least once. Of course, the second time it is saved, then you'd being using the new object and I can see how it wouldn't work.

Once possibility might be to rehook the event each time the object is saved, perhaps in OnDeserialized() or in your UI code that unbinds the object before saving and rebinds it afterwards.

basile replied on Thursday, January 08, 2009

@rsbaker0: it used to work in CSLA 3.5 and stopped working once we updgraded to CSLA 3.6. We do reattach the Saved event handler within the CslaDataProvider.DataChanged event, but the OnSaved() is still not been raised. Also, since we are attaching the event handler in the UI code, we are unable to to use OnDeserialized to reattach the handler.

Copyright (c) Marimer LLC