title: Show Bootstrap Modal From ASP.Net Button Not Working When Validation Added
body: <p>I can display a Modal when using an ASP.Net button (while using the solution given here: <a href="https://stackoverflow.com/questions/25172311/display-bootstrap-modal-from-asp-net-webforms">Display Bootstrap Modal from Asp.Net Webforms</a>)
  My problem is that the Modal doesn't display when I add ASP.Net Validation to the form. Any idea why this might be?
  This is the Modal:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;!-- Success Modal --&gt;
      &lt;div class="modal fade" id="modSuccess" role="dialog" aria-labelledby="myModalLabel"
          aria-hidden="true"&gt;
          &lt;div class="modal-dialog"&gt;
              &lt;asp:UpdatePanel ID="upModal" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional"&gt;
                  &lt;ContentTemplate&gt;
                      &lt;div class="modal-content"&gt;
                          &lt;div class="modal-header"&gt;
                              &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;
                                  &amp;times;&lt;/button&gt;
                              &lt;h4 class="modal-title"&gt;
                                  &lt;asp:Label ID="lModalTitle" runat="server" Text=""&gt;&lt;/asp:Label&gt;&lt;/h4&gt;
                          &lt;/div&gt;
                          &lt;div class="modal-body"&gt;
                              &lt;asp:Label ID="lModalBody" runat="server" Text=""&gt;&lt;/asp:Label&gt;
                          &lt;/div&gt;
                          &lt;div class="modal-footer"&gt;
                              &lt;button class="btn btn-info" data-dismiss="modal" aria-hidden="true"&gt;
                                  Close&lt;/button&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/ContentTemplate&gt;
              &lt;/asp:UpdatePanel&gt;
          &lt;/div&gt;
      &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is one of the Validation blocks:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="form-group"&gt;
    &lt;label&gt;
      Year of Birth*&lt;/label&gt;
    &lt;asp:TextBox class="form-control" ID="tYOB" runat="server"&gt;&lt;/asp:TextBox&gt;
    &lt;asp:RequiredFieldValidator ID="rfvYOB" runat="server" ControlToValidate="tYOB" Display="None" ErrorMessage="Year of Birth is required" ValidationGroup="Choice"&gt;&lt;/asp:RequiredFieldValidator&gt;
    &lt;asp:ValidatorCalloutExtender ID="rfvYOBValidatorCalloutExtender" runat="server" TargetControlID="rfvYOB" Enabled="True"&gt;
    &lt;/asp:ValidatorCalloutExtender&gt;
    &lt;asp:RegularExpressionValidator ID="revYOB" runat="server" ControlToValidate="tYOB" Display="None" ErrorMessage="Year of Birth must be a 4 digit Year" ValidationExpression="^\d{4}$" ValidationGroup="Choice"&gt;&lt;/asp:RegularExpressionValidator&gt;
    &lt;asp:ValidatorCalloutExtender ID="revYOB_ValidatorCalloutExtender" runat="server" TargetControlID="revYOB" Enabled="True"&gt;
    &lt;/asp:ValidatorCalloutExtender&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And here is the button:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="form-group"&gt;
    &lt;asp:Button class="btn btn-success" ID="btnInsert" runat="server" CausesValidation="True" Text="Insert Choice" ValidationGroup="Choice" /&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>And here is the CodeBehind:</p>
  
  <pre><code> Protected Sub btnInsert_Click(sender As Object, e As System.EventArgs) Handles btnInsert.Click
      'This inserts the Choice
      Try
  
        With CInfo
          'More code here
          .insert()
        End With
  
        lModalTitle.Text = "Choice Entered"
        lModalBody.Text = tChoice.Text &amp; " has been successfully entered"
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "modSuccess", "$('#modSuccess').modal();", True)
        upModal.Update()
  
      Catch ex As Exception
        'Catch Code
      End Try
    End Sub
  </code></pre>