TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Adam
NA
5
0
Problem upon cancelling a postback with javascript's confirm()
Apr 26 2010 6:41 AM
I have an aspx page that interacts with a database. The user input gets stored into a session so that I can compare it to the database's current (concurrency) state. If the user moves to a different page, after applying the changes to the session, but before saving the data to the database. A javascript confirm() dialog pops up and warns the user that their session data will be lost if they continue. If the user cllicks cancel ( cancelling the postback) the user remains at the current page, as expected. However the next time any kind of postback is requested by the user, the old postback resumes, pushing the user to previously request page.
My page is quite complex, I have a top panel for navigation purposes. I then have a tree view on the left of the page for sub navigation and a Multiview to the right which displays different usercontrol pages depending on which option is currently selected within the treeview. When ever a tree view option is selected the usercontrol changes and the session data persists. If a navigation option from the top panel is requested, the dialog warns the user that leaving the page will destroy any unsaved session data. If the user cancels the operation the postback is cancelled. however, if the user next clicks on one of the treeview navigation options, the previous postback (top panel button) is performed, which means the session data is destroyed and the user is sent to the wrong page.
So basically the javascript return confirm() dialog seems to only halt the current postback, until the next postback is requested. It seems that the old postback is remembered and given priority over a new postback. Can this behaviour be stopped so that the newer and correct postback is executed.
Any help is appreciated, this is my first post so I hope it makes sense.
Reply
Answers (
2
)
MANAGED heap and reference types
which event raise when we click back arrow button of web browser?