Hi
I have a form which will update a database row. The app is multi-user app.
Unfortunately, the database HAS to use pessimistic application locking, which means that when an existing row is read into the form for editing, a bit/tinyint is flipped to lock the record from other users.
This is all OK - when the user has finished updating or clicks 'cancel' the row is unlocked again.
However - if a user starts to edit and cancels by clicking the back button or navigates away, this leaves the row locked.
My solution was to unlock the record in Page_Unload as this will fire if the backbutton is clicked, but doing this will also unlock the record for a postback (not good if the user is updating).
My question is - how can I detect whether a postback has been raised in the Page_Unload sub/event? I'm assuming the Page.IsPostBack test won't work as this will just determine whether the current page being viewed is a post back.
In pseudo code, I would lie to do something like:
Code:
Sub Page_Unload
If "PostBackEventHasBeenRaised" Then
'Do postback as normal
Else
'Unlock the current record being edited
End If
End Sub
I'm hoping there is a simple answer (e.g. an equivalent of Page.IsPostBack but for the post back event)!
Cheers
Graham.