W
WISEMANOFNARNIA
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.redirect is the statement that fails). Is there any way to
accomplish what I'm trying to do?
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Unload
If Not Session("ExitViaButton") Then
Session("BadExitOfDOEditPage") = True
Response.Redirect("~/Pages/home.aspx?
Pageload=DailyOutreachFormEdit")
End If
End Sub
-- Marv
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.redirect is the statement that fails). Is there any way to
accomplish what I'm trying to do?
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Unload
If Not Session("ExitViaButton") Then
Session("BadExitOfDOEditPage") = True
Response.Redirect("~/Pages/home.aspx?
Pageload=DailyOutreachFormEdit")
End If
End Sub
-- Marv