473,785 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Differentiate between a page unload and a page refresh.

1 New Member
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 2413
shweta123
692 Recognized Expert Contributor
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

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

Similar topics

1
2617
by: Matt | last post by:
When the page is refresh, it will first call window_unload() and then call window_load(). The problem is I window_unload() is invoked when the user click close button, or right top icon close button. I don't want refresh will call window_unload. Any ideas? thanks!! function window_load() {//etc.. }
4
9136
by: Stephajn Craig | last post by:
I have one page that may take a while to process on the server, and I'd like to implement a please wait message on this page when it posts back to the server and does its business. The page is an ASP.NET webform that contains a Web User Control. The Web User Control is doing all of the work posting. How can I inform the user of what is happening at the server while the data from this web user control is being processed? --
2
2640
by: adam | last post by:
Hi ASP Expert, I encounter a page reload situation in ASP. It is I need a way to differentiate whether the current page - "Application_Result.asp" got reloaded itself when user click on the browser Refresh button or is requested by the previous page "Application_Form.asp". I tried using <%if Request.ServerVariables("REQUEST_METHOD") = "POST" then%> <!--it is requested from "Application_Form.asp, do something-->
1
1933
by: mgonzales3 | last post by:
I have a popup that does a postback to populate a listbox. on my content page I want to fire a jscript that will refresh the parent on the unload. the code on the content page looks like this. <script> function refreshParent() { window.opener.location.href = window.opener.location.href; if (window.opener.progressWindow) window.opener.progressWindow.close();
1
8567
by: Donkey Cart Racer | last post by:
Hi, I have a page - page1 which opens a window1 where users can look at tasks, in window1 users can click and open window2 where they can create new tasks I want to refresh window1 when window2 closes and refresh page1 when window 1 closes
1
4178
by: BennyVK | last post by:
Hi, I'm not sure if this question should go to the "JavaScript" section; but I'm open to non-JavaScript (like VBScript) options too. So, I'm posting this here. I have the following problem: For my application, I need to ask a confirmation when the user closes the browser-window. If the answer is positive, I would like to log-off
1
2107
by: Areric | last post by:
Hey all, Does anyone know how i can detect a refresh of the page in the unload event on the server? The problem I'm having is that refresh automatically calls the previous event that happened via a postback. So if you click save in our app, itll call save again if you refresh. I would like to grab that refresh and have it execute a different command which clears out the screen and repopulates the latest data (i.e. a real refresh) but...
2
2691
by: sanjeevcis | last post by:
Hi Everybody, Is there any way to differentiate window closing and window refreshing. Actually I need the code regarding this. I want to get the Popup when i close the perticular window but not when i refresh that window. I used OnUnload event in the body tags to open the Popup when the window is closed.But it is also executing when i refresh the window also!!!!.Please help me out if anybody does know the...
5
5900
by: =?Utf-8?B?U3RldmVuIFRhbmc=?= | last post by:
It seems that one page XBAP whose Unloaded event never get called, I need put some clearing stuff (I.G stop dispatcher time) when user close browser, it unload event doesn't work, where shall I put? -- ======================= Steven Tang SYWWUYU)
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8978
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.