Note that there are some explanatory texts on larger screens.

plurals
  1. POModalPopupExtender shows popup when the user hits the back button
    primarykey
    data
    text
    <p>How do I stop a ModalPopupExtender from showing the popup when a user navigates to the page via the browser's back button?</p> <p>I tried to implement the solution found <a href="http://forums.asp.net/p/1261943/2373610.aspx" rel="nofollow">here</a> which essentially handles the ModalPopup using client side script but had trouble with its implementation. ($find("modPop") always returns null). </p> <p>Are there other techniques for handling this?</p> <p>EDIT: <b>The plot thickens</b>. This only occurs because I am using an UpdatePanel inside of the popup. The code below should duplicate the error. Also note, the use of the dummy button is required.</p> <ol><li>Click button to show modal</li><li>Confirm modal</li> <li>Navigate away from page</li> <li>Navigate back to page w/ back button</li> <li>Modal appears undesireably.</li></ol> <pre><code>&lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" %&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"&gt; &lt;/asp:ScriptManager&gt; &lt;span style="display:none;"&gt;&lt;asp:Button ID="btnDummy" runat="server" Text="Dummy" /&gt;&lt;/span&gt; &lt;asp:Button id="btnShow" runat="server" Text="Show Modal"/&gt; &lt;ajax:ModalPopupExtender ID="mpTest" runat="server" TargetControlID="btnDummy" PopupControlID="pnlTest"&gt;&lt;/ajax:ModalPopupExtender&gt; &lt;asp:Panel id="pnlTest" style="display:none;border:10px solid green" DefaultButton="btnTest" runat="server"&gt; &lt;asp:UpdatePanel ID="upTest" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:Button ID="btnTest" runat="server" Text="Test" /&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;ajax:AsyncPostBackTrigger ControlID="btnTest" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;/asp:Panel&gt; &lt;a href="http://stackoverflow.com"&gt;StackOverflow&lt;/a&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <pre>Partial Class Test Inherits System.Web.UI.Page Protected Sub btnShow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShow.Click mpTest.Show() End Sub Protected Sub btnTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTest.Click mpTest.Hide() End Sub End Class</pre> <p>I think this makes sense as when you confirm the modal a full postback doesn't happen but I need to do it this way. Are there any workarounds? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload