Link to home
Create AccountLog in
Avatar of praetorean
praetoreanFlag for Singapore

asked on

how to capture the page unload event in vb.net on asp.net

hi all,

does anyone know how to capture a page's unload event? something like a windows form's form_unload event?...

i need to be able to validate that event when the page is being closed, navigated from or to another page to prompt the user to save the data...

thanks in advance
Avatar of Muhammad Kashif
Muhammad Kashif
Flag of Pakistan image

Use the FormClosing event for that purpose.

and use
e.Cancel = True
If you don't let the user to close the page.
Please go through this link
http://msdn.microsoft.com/en-us/library/system.web.ui.control.unload.aspx
 
i have given yiou example in c#
 

protected void Page_unLoaded(object sender, EventArgs e) 
{
.....
.....
....
}

Open in new window

SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of praetorean

ASKER

as posted above:
"i have opted to forgo on this approach in the sense that the unload event would be a limitation while, any events triggered from the page's UI control would be checked to save the data on the page..."