keysersoze
asked on
detailsview missing data after unsucceded insert
I have a DetailsView in insert-mode, this contains some text-boxes with validation and a button with insert-commandname - when i click the button (and validation passes) my InsertMethod of my objectdatasource is fired.
My BLL do also have some validation and if this validation is passed everything is good - but if the validation fails I get a problem. If the BLL-validation fails i catch this up in the Inserted-event of my objectdatasource and gives the user an error-message... but the data filled in the detailsview is gone, not because of missing viewstate I guess but probably because it thinks everything in the insert-method was going well.
How can I catch up the BLL error and keep the userinput in the detailsview?
My BLL do also have some validation and if this validation is passed everything is good - but if the validation fails I get a problem. If the BLL-validation fails i catch this up in the Inserted-event of my objectdatasource and gives the user an error-message... but the data filled in the detailsview is gone, not because of missing viewstate I guess but probably because it thinks everything in the insert-method was going well.
How can I catch up the BLL error and keep the userinput in the detailsview?
after showing the message box you can try cancelling the validation event.
ASKER
I have tried to find a way to do this - but so far I havent found a way to do the trick...
for cancelling the event you need to use eventobj.cancel=true
ASKER
the inserted-event cant be cancelled?
thats what ..... can't you do validation before this event.
ASKER
in theory yes - but when the logic is a part of my object it would be double the work to put the logic more places so that is not a solution.
ASKER
problem solved.
I threw af new applicationerror in my BLL, catching that up in my detailsview ItemUpdated event where I handle ExceptionHandled and KeepInEditMode.
I threw af new applicationerror in my BLL, catching that up in my detailsview ItemUpdated event where I handle ExceptionHandled and KeepInEditMode.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.