navigate and postback

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alejandro Penate-Diaz

    navigate and postback

    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('B utton8','')

    }



    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('B utton8','') 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('B utton8','');



    window.navigate ("another_page. aspx");

    }


Working...