Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to continue with asp.net server side button click method after interaction wtih jQuery UI Dialog?
    text
    copied!<p>From a jQuery noob, any help is appreciated with this as I've wasted too much time already with a deadline fast approaching.</p> <p>The lowdown - I have an asp.net form in an intranet engineering application that needs to pop up a jQuery dialog when the Submit button is pressed in certain circumstances.</p> <p>In the "certain circumstances" the user needs to confirm a question and the form needs to continue with submission <strong>including</strong> executing the server-side code for the Submit button's Click event.</p> <p>When the "certain circumstances" don't exist, the form needs to simply submit and execute the server-side code for the Submit button's Click event. (Same as above, but with no jQuery Dialog.)</p> <p>The challenge seems to be:</p> <ul> <li>When the dialog closes, the form submits but it is obviously *not* as if the original Submit button caused it since the only server-side code being executed is `Page_Load`. The `cmdSave_Click' (which is what I also need to execute) is not called. </ul> <p>Here is the dialog box definition. (On both button clicks I need to stick a value in a hidden field that the server-side <code>cmdSave_Click</code> method ultimately needs.)</p> <pre><code>var dlgTidPopup = $('#popupPnlTid').dialog({ resizable: false, autoOpen: false, draggable: false, modal: true, closeOnEscape: false, title: 'Request for Target Identifier (TID)?', buttons: { "yes": function () { $('#txtTidYes').val("1"); $('#userInputForm').unbind("submit").submit(); $(this).dialog('close'); }, "no": function () { $('#txtTidYes').val("0"); $('#userInputForm').unbind("submit").submit(); $(this).dialog('close'); } } }); dlgTidPopup.parent().appendTo($('form:first')); </code></pre> <p>Here is the submission portion. The <code>if</code> statement determines the appearance of the dialog to satisfy the "is this that certain circumstance?" requirement.</p> <pre><code>$('#userInputForm').submit(function (event) { if ($('#hdnSituationIsTid').val() == "1") { event.preventDefault(); $('#popupPnlTid').dialog("open"); } }); </code></pre> <p>The submit button looks like:</p> <pre><code>&lt;asp:ImageButton ID="ibtnSend" ImageUrl="../_common/Images/buttons/Send.gif" runat="server" OnCommand="cmdSave_Click" CommandName="Send" CssClass="majorButton" CausesValidation="false" /&gt; </code></pre> <p>The answer to this is probably so simple and I am just lacking in knowledge. Any guidance is greatly appreciated. (Also, do know that I've scoured SO and read many, many posts and have even modeled my code after many of them, but I haven't quite found a resolution to my specific question.)</p>
 

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