Prevent return to Parent Window until close Popup Window using jQuery in ASP.Net

Last Reply 3 months ago By khaled2016

Posted 3 months ago

HI

How to prevent return prev-page until click close button in page 2 .

another mean no back to page 1 until click close button on popup.

Page 1 aspx 

Protected Sub OpenWindow(ByVal sender As Object, ByVal e As EventArgs)
    Dim url As String = "page2.aspx"
    Dim s As String = "window.open('" & url + "', 'popup_window', 'width=300,height=100,left=100,top=100,resizable=yes');"
    ClientScript.RegisterStartupScript(Me.GetType(), "script", s, True)
End Sub

 

<asp:Button ID="btnNewWindow" Text="Open new Window" runat="server" OnClick="OpenWindow" />

Page 2 aspx

<asp:Button ID="btnOK" runat="server" OnClientClick="window.close(); return false;" Text="Close" />

 

You are viewing reply posted by: khaled2016 3 months ago.
Posted 3 months ago

I found answer here using jquery that prevent back to first page when click on background page until press close button in popup window .

Simple jQuery Modal Popup Window Example in ASP.Net