Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Looks like the <code>ModalPopupExtender</code> isn't designed this way. While it is <em>modal</em> (prevents the user from interacting with the rest of the page), it's not <em>blocking</em>, mean code continues to run after the form is called. That's because the popup is running on the client, and the code-behind runs the server. This is called a <a href="http://en.wikipedia.org/wiki/Callback_%28computer_programming%29" rel="nofollow">callback</a> because the client code <em>calls back</em> to the server when a action is taken.</p> <p>To make this work, you have to split the logic you after <code>SignoffModal.Show();</code> in an "Ok" part and a "Cancel" part by adding a <code>CancelControlID</code> attribute on <code>ModalPopupExtender</code> to point to the button that handles the Cancel action, then add the button: </p> <pre><code> &lt;!-- Signoff Modal Form --&gt; &lt;asp:HiddenField ID="SignoffForModal" runat="server" /&gt; &lt;ajaxToolkit:ModalPopupExtender runat="server" ID="SignoffModal" BehaviorID="modalPopupExtenderSignoff" TargetControlID="SignoffForModal" PopupControlID="popUpPaneSignoff" OkControlID="btnSignoff" // points to cancel button action CancelControlID="btnCancel" BackgroundCssClass="modalBackground"&gt; </code></pre> <p>... </p> <pre><code>&lt;asp:Button ID="btnSignoff" runat="server" Text="Signoff" /&gt; // handles Cancel action... &lt;asp:Button ID="btnCancel" runat="server" Text="Cancel" /&gt; ... &lt;!-- End Signoff Modal Form --&gt; </code></pre> <hr> <p>in the <code>btnSignoff</code> code-behind event handler:</p> <pre><code>{ // Do some work... </code></pre> <p>in the <code>btnCancel</code> code-behind event handler:</p> <pre><code>{ //throw some error... </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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