Adding Client-side Javascript to a Wizard Control SideBarButton

Discussion in 'ASP .Net Web Controls' started by daSharp, Sep 8, 2008.

  1. daSharp

    daSharp Guest

    I would like to add a javascript function call to the SideBarButton in an
    ASP:Wizard control in ASP 3.5.

    I have a onbeforeunload function defined that I do not want to execute
    everytime the user clicks on a menu item in the sidebar. It should only be
    called when the user closes the web page. I would like to set a var when the
    user clicks a menu item that the onbeforeunload function can evaluate and
    know to skip the onbeforeunload function for this postback.

    This is the javascript on the webpage:

    <script type="text/javascript">

    var IGNORE_UNLOAD = false;

    function doBeforeUnload()
    {
    if (IGNORE_UNLOAD = false)
    {
    document.getElementById('<%=btnLogout.ClientID %>').click();
    //Call the hidden logout button click event ;
    }
    }

    if(window.body)
    window.body.onbeforeunload = doBeforeUnload; // IE
    else
    window.onbeforeunload = doBeforeUnload; // FX
    </script>

    I need a way to set the var IGNORE_UNLOAD = true from a menu click in the
    wizard.

    Thanks.

    Don Sharp
     
    daSharp, Sep 8, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lau Lei Cheong
    Replies:
    1
    Views:
    632
    Lau Lei Cheong
    Oct 13, 2004
  2. =?Utf-8?B?U2lsZWVzaA==?=
    Replies:
    0
    Views:
    490
    =?Utf-8?B?U2lsZWVzaA==?=
    Nov 3, 2004
  3. =?Utf-8?B?TWlrZSBSYW5k?=

    Adding Server Side code in a Client Side Script???

    =?Utf-8?B?TWlrZSBSYW5k?=, Jan 30, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,175
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jan 30, 2006
  4. Keithb
    Replies:
    1
    Views:
    822
    bruce barker
    Feb 26, 2007
  5. Zoe Hart
    Replies:
    1
    Views:
    402
    Scott Wisniewski
    Jan 8, 2004
Loading...

Share This Page