Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
C# How To Find Which Link Was Clicked On A Master Page
Old 06-01-2012, 05:07 PM C# How To Find Which Link Was Clicked On A Master Page
mb2000inc's Avatar
Extreme Talker

Posts: 153
Name: Mark
Location: Ohio
Trades: 0
I know this is probably a stupid question, but I have to ask.
First, let me explain the scenario.
I have a content page (within a master page). I am using a javascript function to prompt a user to save their changes before navigating away.
(inside the function, it calls a WebMethod that saves their changes automatically), but then, I want them to be able to be redirected to the page they clicked after the save event....

The only thing I could think of was to get the link they clicked, and redirect them there.... How would I go about that?

Or if there's another way for them to continue their navigation after the function was called in the javascript... that would be cool, too. :-)
__________________
Need a vacation.
mb2000inc is offline
Reply With Quote
View Public Profile Visit mb2000inc's homepage!
 
 
Register now for full access!
Old 06-04-2012, 09:12 AM Re: C# How To Find Which Link Was Clicked On A Master Page
mb2000inc's Avatar
Extreme Talker

Posts: 153
Name: Mark
Location: Ohio
Trades: 0
Hmmm... no takers?
__________________
Need a vacation.
mb2000inc is offline
Reply With Quote
View Public Profile Visit mb2000inc's homepage!
 
Old 06-04-2012, 10:01 AM Re: C# How To Find Which Link Was Clicked On A Master Page
chrishirst's Avatar
Defies a Status

Posts: 43,963
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You will have to pass some parameter to the routine that identifies what link was clicked.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-04-2012, 11:44 AM Re: C# How To Find Which Link Was Clicked On A Master Page
mb2000inc's Avatar
Extreme Talker

Posts: 153
Name: Mark
Location: Ohio
Trades: 0
Hi, thanks for the reply!

Would something like this work?

Code:
        $(document).ready(function () {
            $('a').click(function () {
                if ($(this).attr('href')) someFunction.href = $(this).attr('href');
            });
        });
Essentially, this is what I'm working with:

Code:
    <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>
Basically, I want to (after the save) redirect the user to where he/she was originally headed to before they clicked away.
__________________
Need a vacation.
mb2000inc is offline
Reply With Quote
View Public Profile Visit mb2000inc's homepage!
 
Old 06-04-2012, 12:10 PM Re: C# How To Find Which Link Was Clicked On A Master Page
chrishirst's Avatar
Defies a Status

Posts: 43,963
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
As you are not returning a false value from your routine it should do that anyway, as the click event will "bubble through" the function.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to C# How To Find Which Link Was Clicked On A Master Page
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.45635 seconds with 11 queries