|
-
May 15th, 2012, 11:01 AM
#1
Thread Starter
PowerPoster
Need to prompt user before navigating away from a page, and perhaps stay on page
I need to check information the user has entered on a page against what I have in my database to see if he is entering duplicate data. It is up to him if he wants to proceed or not. I just need to alert him.
The problem is I don't own the button that he clicks so I can't hook up a javascript confirm to the button click. I am running within vendor code. I have an "override PageLoad()" procedure where I can test what page they're currently on. If they are on page "EditForm.aspx" and would normally navigate to "UserFinish.aspx" without any custom code of mine "interfering", I want to test what they've entered on EditForm.aspx and present them with a popup if they've entered duplicate info, and if they click OK button then proceed to UserFinish but if they click Cancel then stay on EditForm.
I've googled and found some things that might work, but it's usually followed by a caveat saying "do the following, but I don't recommend it", so I just wanted to ask for a way that is recommended. Thanks.
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
May 15th, 2012, 11:07 AM
#2
Re: Need to prompt user before navigating away from a page, and perhaps stay on page
Does it have to be a message box? I've found that trying to work with MessageBoxes are a pain in ASP.NET. I just use hidden buttons and when there's an exception, I show the buttons.
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
May 15th, 2012, 11:12 AM
#3
Thread Starter
PowerPoster
Re: Need to prompt user before navigating away from a page, and perhaps stay on page
I'm not sure what you mean exactly, but I don't have a page on which to hide any buttons. I just have a C# class that's compiled and the DLL that's created gets put in the deployment, and the vendor code will call it simply because it exists and I've defined a path to it. But the vendor page calls my code. I don't have a page.
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
May 15th, 2012, 11:14 AM
#4
Re: Need to prompt user before navigating away from a page, and perhaps stay on page
 Originally Posted by MMock
I'm not sure what you mean exactly, but I don't have a page on which to hide any buttons. I just have a C# class that's compiled and the DLL that's created gets put in the deployment, and the vendor code will call it simply because it exists and I've defined a path to it. But the vendor page calls my code. I don't have a page.
Oh. I see what you mean. Hm... well, wouldn't you just create a method that returns a boolean and then allow them to handle it how they choose?
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
May 15th, 2012, 07:06 PM
#5
Re: Need to prompt user before navigating away from a page, and perhaps stay on page
 Originally Posted by weirddemon
Oh. I see what you mean. Hm... well, wouldn't you just create a method that returns a boolean and then allow them to handle it how they choose?
I concur to that.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
May 16th, 2012, 06:46 AM
#6
Thread Starter
PowerPoster
Re: Need to prompt user before navigating away from a page, and perhaps stay on page
A server method or a client method?
And returns a boolean to where?
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
May 16th, 2012, 07:41 PM
#7
Re: Need to prompt user before navigating away from a page, and perhaps stay on page
If you use webservice then fix up client method.If you use webserver then fix up a server method.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|