Pete2003
asked on
saving data before changing pages
Hi All,
I have a page with a drop down list box ... every time I change the selection of the list box ... some data gets populated in the edit boxes below ... this data is connected to the selection in the list box.
When the data is displayed ... I am able to change it an press the apply button to save the changes.
If I however navigate away from the page or if i change the selection in the list box without saving the changes, I inform the user of this.
This is done by using the onbeforeunload event on the HTML page.
however if I chose to cancel and remain on the page, even though the new data for the edit boxes is not loaded ... the selection in the drop down list changes to the new one.
How do I prevent the selection of the new item in the drop down list from taking place.
this gets called in onbeforeunload.
This is the JS snippet that checks for the cancel/ok ...
if (btnApply.disabled == false)
{
event.returnValue = "You will lose your changes"
}
I'm not even sure if this will be a JS or a C# issue ...
Txs
Peter
I have a page with a drop down list box ... every time I change the selection of the list box ... some data gets populated in the edit boxes below ... this data is connected to the selection in the list box.
When the data is displayed ... I am able to change it an press the apply button to save the changes.
If I however navigate away from the page or if i change the selection in the list box without saving the changes, I inform the user of this.
This is done by using the onbeforeunload event on the HTML page.
however if I chose to cancel and remain on the page, even though the new data for the edit boxes is not loaded ... the selection in the drop down list changes to the new one.
How do I prevent the selection of the new item in the drop down list from taking place.
this gets called in onbeforeunload.
This is the JS snippet that checks for the cancel/ok ...
if (btnApply.disabled == false)
{
event.returnValue = "You will lose your changes"
}
I'm not even sure if this will be a JS or a C# issue ...
Txs
Peter
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER