title: Jquery DataTable loads fine initially, but without formatting/styling when command is sent to change data
body: <p>I am using a JQuery datatables plug in within an ASP.NET update panel and it works great when the call to load the table first loads. However, when I call a method to retrieve new data on the table, the formatting/styling is gone. The data is there, but the formatting from the datatable is not.</p>
  
  <p>Here is what I have tried:</p>
  
  <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
      &lt;ContentTemplate&gt;
  
              &lt;asp:GridView ID="tblCalendar" runat="server" AutoGenerateColumns="false" CssClass="table table-bordered table-striped" Visible="true"&gt;
                  &lt;RowStyle CssClass="myrow" /&gt;
                  &lt;AlternatingRowStyle CssClass="myrow" /&gt;
                  &lt;Columns&gt;
                      &lt;asp:BoundField DataField="Subject" HeaderText="Subject" /&gt;
                      &lt;asp:BoundField DataField="Date" HeaderText="Date" /&gt;
                  &lt;/Columns&gt;
              &lt;/asp:GridView&gt;
  
      &lt;/ContentTemplate&gt;
   &lt;/asp:UpdatePanel&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>and jquery - I thought I could empty and reload the table but it doesn't work.</p>
  
  <pre><code>function reloadTable() {
   $('#tblCalendar').empty();
   var table = $('#tblCalendar').DataTable();
   table.reloadTable();
  
   $("[id*=tblCalendar]").prepend($("&lt;thead&gt;&lt;/thead&gt;").append($(this).find("tr:first"))).DataTable({
      "paging": true,
      "lengthChange": true,
      "searching": true,
      "ordering": true,
      "info": true,
      "autoWidth": true,
      "responsive": true,
      "dom": 'lBfrtip',
      "order": [[1, "asc"]],
      "buttons": ['excel', 'print', 'pdfHtml5']
   });
  }
  </code></pre>
  
  <p>and code behind</p>
  
  <pre><code>    protected void btnUpdate_Click(object sender, EventArgs e)
      {           
          MethodThatUpdatesMyTable();
          ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "myFunction", "reloadTable();", true);
      }
  </code></pre>
  
  <p>The data on the table is being retrieved from an Outlook Calendar - the button to change the data simply changes the calendar date and it should load the results in the datatable with formatting/styling but it is not. I'm assuming it has something to do when the postback occurs but not sure what is needed.</p>