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

Last Reply 11 months ago By khaled2016

Posted 11 months ago


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 = "'" & 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" />


Posted 11 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