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

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!
 
M

Mark Rae [MVP]

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...
 
P

Peter Bromberg [C# MVP]

M

msgroup

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!
 
M

Mark Rae [MVP]

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top