I would like to prevent a user from exiting a page by clicking on
links. the only way he should be able to exit is clicking on a 'save'
button or a 'cancel' button. I can see that javascript is the only
way to prevent him from closing his browser completely before doing a
'save', but I was wondering if asp.net had a way of preventing him
from leaving the page by clicking on links. The following code does
not work - in fact it gives an error when it is tried
(response.redir ect is the statement that fails). Is there any way to
accomplish what I'm trying to do?
Protected Sub Page_Unload(ByV al sender As Object, ByVal e As
System.EventArg s) Handles Me.Unload
If Not Session("ExitVi aButton") Then
Session("BadExi tOfDOEditPage") = True
Response.Redire ct("~/Pages/home.aspx?
Pageload=DailyO utreachFormEdit ")
End If
End Sub
-- Marv