postback and navigate question

  • Thread starter Alejandro Penate-Diaz
  • Start date
A

Alejandro Penate-Diaz

Hi. I need to ask the user whether to save the information on a page to a
sql server when exiting or navigating away, so I am using this code when
clicking the X button. the Button8 (an asp.net server control) does
that(save to database) when clicked so I am reusing
it in my javascript:

//this code is launched in the OnBeforeUnload event in the <body> section
function HandleOnClose()

{

if (event.clientY < 0)

if (confirm("OK to save changes. Cancel to exit without saving.") )
__doPostBack('Button8','')

}



The code above works fine, problem comes with the following code that I am
using when the user clicks a link to another page, code
__doPostBack('Button8','') is never executed. is there a simple work around
for what I want to do?:


// this code is launched when clickin in my page's links
function goToAnotherPage()

{

if (confirm("OK to save changes. Cancel to show Another Page without
saving.") ) __doPostBack('Button8','');



window.navigate("another_page.aspx");

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top