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

  • Thread starter Thread starter Chris Roden
  • Start date Start date
C

Chris Roden

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!
 
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...
 
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!
 
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...
 
Back
Top