title: How to add Jquery DataTables onto asp.net's GridView
body: <p>I know this question is asked quite a lot, and I've tried to apply the fixes that I've seen people recommend but it won't seem to work for my grid view when I'd try it. </p>
  
  <p>The datatables applies to other regular tables I write myself, but it won't add it to the gridview.</p>
  
  <p>The code I use for the subcomputing.aspx page is</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="subComputing.aspx.cs" Inherits="WebEnterprise.Pages.Departments.Computing.subComputing" %&gt;
  &lt;asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server"&gt;
      &lt;script src="../../../Scripts/jquery-3.3.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"&gt;&lt;/script&gt;
      &lt;link href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" rel="stylesheet" /&gt;
  
      &lt;script&gt;
          $(function () {
              $("#computingPostGridView").prepend($("&lt;thead&gt;&lt;/thead&gt;").append($(this).find("tr:first"))).dataTable();
          });
      &lt;/script&gt;
  
  &lt;div  class="jumbotron"&gt;
  
      &lt;asp:GridView ID="computingPostGridView" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" OnSelectedIndexChanged="computingPostGridView_SelectedIndexChanged" Width="506px"&gt;
          &lt;Columns&gt;
              &lt;asp:BoundField DataField="postTitle" HeaderText="postTitle" SortExpression="postTitle" /&gt;
              &lt;asp:BoundField DataField="postCategory" HeaderText="postCategory" SortExpression="postCategory" /&gt;
              &lt;asp:BoundField DataField="postDate" HeaderText="postDate" SortExpression="postDate" /&gt;
          &lt;/Columns&gt;
      &lt;/asp:GridView&gt;
      &lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&lt;%$ ConnectionStrings:DefaultConnection %&gt;" SelectCommand="SELECT [postTitle], [postCategory], [postDate] FROM [Posts]"&gt;&lt;/asp:SqlDataSource&gt;
    &lt;br /&gt;
  
  &lt;/div&gt;
  &lt;/asp:Content&gt;
  </code></pre>