469,322 Members | 1,605 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,322 developers. It's quick & easy.

Differentiate between a page unload and a page refresh.

Hi Guys,

Have been looking at this for a while and not sure if there is a solution but hopefully someone can point me in the right direction:

The problem is essential I want to undo an update if the user unloads a page but not if they just refresh the page.

Detail:
I have 2 asp pages.
Page 1 solicits some information and updates the database. This information is then posted to Page 2, where further details are entered and a final update is done. If however the user does not confirm the update on Page 2 and unloads the page I undo all updates by calling a function in the OnUnLoad event. This works fine but the problem is this function is also called if the user just does a Refresh on page 2.

In Summary:
Page 1, enter information,
Submit and Update the Database
Post details to Page 2
Enter more information on Page 2 and complete the update.
If Page 2 is unloaded OnUnLoad function is called and all updates are cancelled.
Problem: If Page 2 is refreshed, the the OnUnLoad event is also called and updates are also cancelled.

Any help would be appreciated.

Thanks.
Jul 26 '07 #1
1 2204
shweta123
692 Expert 512MB
Hi,

Is there any specific need for updating partial information on page1? Instead, you can pass all the information from page1 to page2 using Hidden fields or some other way and then make a final update on Page2 only. So this will not affect page_unload or refresh.
Aug 7 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Matt | last post: by
4 posts views Thread by Stephajn Craig | last post: by
1 post views Thread by mgonzales3 | last post: by
1 post views Thread by Donkey Cart Racer | last post: by
1 post views Thread by Areric | last post: by
5 posts views Thread by =?Utf-8?B?U3RldmVuIFRhbmc=?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Gurmeet2796 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.