1 Replies - 2785 Views - Last Post: 04 June 2012 - 06:14 AM Rate Topic: -----

#1 mb2000inc   User is offline

  • D.I.C Regular
  • member icon

Reputation: 24
  • View blog
  • Posts: 354
  • Joined: 10-November 09

C# and JavaScript Find Clicked Link From Master Page

Posted 01 June 2012 - 02:27 PM

I know, that was a complicated Topic Title. (sorry)
So, it's been a while since I've posted here - and I got lonely.
(I missed you guys - that and I have a huge question).

First, an explanation: (scroll down for actual question**)

I have a Content Page within a Master Page.
I'm using a Javascript Function to prompt a user to save their work before navigating away from the page.
    <script type="text/javascript">
        //<![CDATA[
        window.onbeforeunload = confirmExit;
        function confirmExit() {
            var answer = confirm("You are attempting to leave this page without saving.  All changes will be lost.  Are you sure you want to exit this page?");
            if (answer)
                alert("Thank You");
            else
                __doPostBack('__Page', "SaveOnExit");
            }
    //]]>
    </script>



If the user elects to SAVE their work, it's calling a "WebMethod" in the backend that saves the data automatically.
        [WebMethod]
        public void LeaveUnloaded()
        {
            //all my save stuff is happening here...
            //there's sensitive data here - so, I won't be posting those lines of code.
        }



By the way, the "__doPostBack('__Page', "SaveOnExit");" is handled in the backend page_load event - calling the actual method:

            if (Request["__EVENTARGUMENT"] == "SaveOnExit")
                LeaveUnloaded();



And ALL of this works - as is.
(**actual question)
BUT, my main question is this....
Is there a way that I can capture the link that they clicked on to navigate away from the page, so that they are redirected (to their original destination) automatically after the save? Either in C# or in Javascript?

Thanks in advance. :)

This post has been edited by mb2000inc: 01 June 2012 - 02:31 PM


Is This A Good Question/Topic? 0
  • +

Replies To: C# and JavaScript Find Clicked Link From Master Page

#2 mb2000inc   User is offline

  • D.I.C Regular
  • member icon

Reputation: 24
  • View blog
  • Posts: 354
  • Joined: 10-November 09

Re: C# and JavaScript Find Clicked Link From Master Page

Posted 04 June 2012 - 06:14 AM

Hmmm... no takers? :(
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1