title: .NET hidden field value not found after JQuery sets it
body: <p>I am having a bit of a hard time trying to get a confirm box working with asp.  My issue right now, is that in my confirm javascript method I am updating a hidden field's value to either 1 or 0, and in the ASP function, I am checking whether or not the value is 1 or 0.  Currently the hiddenfield value is "".</p>
  
  <p>Front End Code:</p>
  
  <pre><code>&lt;asp:HiddenField ID="txtconfirmmessageValue" runat="server" /&gt;
  /* redacted code*/
  &lt;asp:LinkButton ID="EndSessionLinkButton" CssClass="SessionDashboardButton" runat="server" OnClientClick="return confirmAll();" OnClick="EndSession" Text="CANCEL" &gt;&lt;/asp:LinkButton&gt;
  </code></pre>
  
  <p>Javascript code:</p>
  
  <pre><code> function confirmAll() {
          if (confirm("You are about to end session. Are you sure you want to do this.")) {
              $('#&lt;%=txtconfirmmessageValue.ClientID %&gt;').val(1);
              return true;
          }
          else {
              $('#&lt;%=txtconfirmmessageValue.ClientID %&gt;').val(0);
              return false;
          }
      }
  </code></pre>
  
  <p>Behind Code ASP.NET</p>
  
  <pre><code>protected void EndSession(object sender, EventArgs e)
  {
      string value = txtconfirmmessageValue.Value;
      while (string.IsNullOrEmpty(value))
      {
          value = txtconfirmmessageValue.Value;
      }
  
      if (!Utility.ToBool(txtconfirmmessageValue.Value))
      {
          return;
      }
      /* redacted */
  }
  </code></pre>
  
  <p>The value of txtconfirmmessageValue is always "" and is never set, even tho I added alerts to the javascript method that alerted the value of the asp:hiddenfield after the event triggered.</p>
  
  <p>NOTE:: I also added the while loop in there to by pass the post back of asp happening before the confirm box event was finished.. I am not sure how to postpone the postback until the confirm box is completed.  Any help would be appreciated.</p>