title: how to close bootstrap modal from code behind?
body: <p>I am doing update operations from modal. When modal popup its load specific row data to which I want to update.
  Below is my modal code:</p>
  
  <pre><code>&lt;form id="form1" runat="server"&gt;
      &lt;asp:ScriptManager ID="sm1" runat="server"&gt;&lt;/asp:ScriptManager&gt;
      &lt;asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional"&gt;
          &lt;ContentTemplate&gt;
              &lt;div id="myModal" class="modal fade" role="dialog" runat="server" draggable="auto"&gt;
                  &lt;div class="modal-dialog"&gt;
  
                      &lt;!-- Modal content--&gt;
                      &lt;div class="modal-content"&gt;
                          &lt;div class="modal-header"&gt;
                              &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
                              &lt;h4 class="modal-title"&gt;Insert Module&lt;/h4&gt;
                          &lt;/div&gt;
                          &lt;div class="modal-body"&gt;
                              &lt;table class="table table-bordered"&gt;
                                  &lt;thead&gt;
                                      &lt;tr&gt;
                                          &lt;td colspan="2" style="text-align: center"&gt;
                                              &lt;label&gt;UPDATE EMPLOYEE DETAIL&lt;/label&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                  &lt;/thead&gt;
                                  &lt;tbody&gt;
                                      &lt;tr&gt;
                                          &lt;td&gt;
                                              &lt;label&gt;FIRST NAME&lt;/label&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;asp:TextBox ID="up_tb1" runat="server"&gt;&lt;/asp:TextBox&gt;
                                              &lt;ajax:filteredtextboxextender id="FilteredTextBoxExtender7" targetcontrolid="up_tb1" filtertype="UppercaseLetters,LowercaseLetters" runat="server"&gt;&lt;/ajax:filteredtextboxextender&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;tr&gt;
                                          &lt;td&gt;
                                              &lt;label&gt;MIDDLE NAME&lt;/label&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;asp:TextBox ID="up_tb2" runat="server"&gt;&lt;/asp:TextBox&gt;
                                              &lt;ajax:filteredtextboxextender id="FilteredTextBoxExtender8" targetcontrolid="up_tb2" filtertype="UppercaseLetters,LowercaseLetters" runat="server"&gt;&lt;/ajax:filteredtextboxextender&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;tr&gt;
                                          &lt;td&gt;
                                              &lt;label&gt;LAST NAME&lt;/label&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;asp:TextBox ID="up_tb3" runat="server"&gt;&lt;/asp:TextBox&gt;
                                              &lt;ajax:filteredtextboxextender id="FilteredTextBoxExtender9" targetcontrolid="up_tb3" filtertype="UppercaseLetters,LowercaseLetters" runat="server"&gt;&lt;/ajax:filteredtextboxextender&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;tr&gt;
                                          &lt;td&gt;
                                              &lt;label&gt;EMAIL&lt;/label&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;asp:TextBox ID="up_tb4" runat="server"&gt;&lt;/asp:TextBox&gt;
                                              &lt;ajax:filteredtextboxextender id="FilteredTextBoxExtender10" targetcontrolid="up_tb4" filtertype="Numbers, LowercaseLetters, Custom" validchars=".@" runat="server"&gt;&lt;/ajax:filteredtextboxextender&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;tr&gt;
                                          &lt;td&gt;
                                              &lt;label&gt;DOB&lt;/label&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;asp:TextBox ID="up_tb5" runat="server" Enabled="false"&gt;&lt;/asp:TextBox&gt;
                                              &lt;ajax:calendarextender id="CalendarExtender2" runat="server" popupbuttonid="ImageButton1" targetcontrolid="up_tb5"&gt;&lt;/ajax:calendarextender&gt;
                                              &lt;asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/img/calendar146.png" Width="16px" Height="16px" /&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;tr&gt;
                                          &lt;td&gt;
                                              &lt;label&gt;USERNAME&lt;/label&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;asp:TextBox ID="up_tb6" runat="server"&gt;&lt;/asp:TextBox&gt;
                                              &lt;ajax:filteredtextboxextender id="FilteredTextBoxExtender12" targetcontrolid="up_tb6" filtertype="Numbers, LowercaseLetters, Custom" validchars=".@" runat="server"&gt;&lt;/ajax:filteredtextboxextender&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;tr&gt;
                                          &lt;td&gt;
                                              &lt;label&gt;PASSWORD&lt;/label&gt;
                                          &lt;/td&gt;
                                          &lt;td&gt;
                                              &lt;asp:TextBox ID="up_tb7" runat="server" TextMode="Password"&gt;&lt;/asp:TextBox&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                      &lt;tr&gt;
                                          &lt;td colspan="2"&gt;
                                              &lt;asp:Button ID="up_tb8" CssClass="btn btn-success" runat="server" Text="UPDATE" OnClick="up_tb8_Click" /&gt;
                                          &lt;/td&gt;
                                      &lt;/tr&gt;
                                  &lt;/tbody&gt;
                              &lt;/table&gt;
                              &lt;asp:ValidationSummary ID="ValidationSummary2" runat="server"
                                  DisplayMode="BulletList" ShowSummary="true" HeaderText="Errors:" /&gt;
                          &lt;/div&gt;
                          &lt;div class="modal-footer"&gt;
                              &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I am loading modal from code behind and populate its fields from codebehind.
  Below is my codebehind code:</p>
  
  <pre><code>protected void up_tb8_Click(object sender, EventArgs e)
      {
          var db = new dbDataContext();
          Employee emp = new Employee();
          db.Sp_Updatevalue(up_id, up_tb1.Text, up_tb2.Text, up_tb3.Text, up_tb4.Text, Convert.ToDateTime(up_tb5.Text), up_tb6.Text, up_tb7.Text);
          ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "ClosePopup();", true);
       }
  </code></pre>
  
  <p>When I click my update button it successfully run my update stored procedure and update values from database. Question is when data update modal pop window was gone but its dim gray background still fixed on my screen I want to close modal properly when my records has been updated and my gridview refreshes and show my updated records.</p>