Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Is there a way to tell if a user is leaving the page?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Roden - 13 Dec 2007 16:59 GMT
I am working on an ASP.NET application utilizing .NET 3.5. One page is using
a multi-view with 10 views. UpdatePanels are used to navigate from one view
to another. There are hundreds of fields and I want to be able to prompt the
user to save if they are leaving the PAGE, not the view. The user should be
able to move freely from view to view, but should be prompted to save if they
try to leave the page. I am at a loss and can't figure this out. Any
assistance is greatly appreciated!
Mark Rae [MVP] - 13 Dec 2007 17:11 GMT
> Any assistance is greatly appreciated!

Not possible.

There are several suggested kludges with <body onunload> but none of them
works properly.

Don't even bother trying...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Peter Bromberg [C# MVP] - 13 Dec 2007 18:00 GMT
Chris,
You have to remember that whatever a user does with your "page" once it gets
into their browser, there is no way the server can have any "knowledge" of
this.  There are some things you can do client-side, however. This is an old
article but all the concepts still hold:
http://www.eggheadcafe.com/articles/20010406.asp
--Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com 

> I am working on an ASP.NET application utilizing .NET 3.5. One page is using
> a multi-view with 10 views. UpdatePanels are used to navigate from one view
[quoted text clipped - 3 lines]
> try to leave the page. I am at a loss and can't figure this out. Any
> assistance is greatly appreciated!
Mark Rae [MVP] - 13 Dec 2007 19:51 GMT
> There are some things you can do client-side, however.

Yes, but that's just common sense validation... As you say, the server can't
know anything of this...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

msgroup - 13 Dec 2007 18:04 GMT
Hi, Chris:

It seems to me that SocketPro is able to solve your particular problem. See
the site http://www.udaparts.com/document/articles/browsercallback.htm

function onMyUnload() //close socket connection

{

   if(clientsocket){

        handler.tell('I am leaving this page now ......');

        clientsocket.WaitAll();

       if(handler)

           clientsocket.Detach(handler);

       clientsocket.Disconnect();

   }

   clientsocket = null;

   handler = null;

}

Cheers!

>I am working on an ASP.NET application utilizing .NET 3.5. One page is
>using
[quoted text clipped - 8 lines]
> try to leave the page. I am at a loss and can't figure this out. Any
> assistance is greatly appreciated!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.