Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery datatable plugin not working with gridview?
    text
    copied!<p>I am trying to use <strong><code>jquerydatatable plugin</code></strong> to the gridview.Data is getting bound in gridview but for some reason plugin is not working</p> <p>I could not find out the exact reason but i am getting error in console as below.Is the problem in the script i have used or in the coding part?</p> <pre><code>TypeError: $(...).dataTable is not a function Source File: http://localhost:3852/YouthPossibilities/jqDatatable.aspx </code></pre> <p>Heres my script i've use</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/jquery.dataTables.js" &gt;&lt;/script&gt; &lt;script type="text/javascript" src="js/jquery.js" &gt;&lt;/script&gt; &lt;link href="css/demo_table.css" rel="stylesheet" type="text/css" /&gt; &lt;script type="text/javascript" charset="utf-8"&gt; $(document).ready(function() { $('#gdView').dataTable(); }) &lt;/script&gt; </code></pre> <p>Heres the aspx code</p> <pre><code> &lt;asp:GridView ID="gdView" runat="server" AutoGenerateColumns="False" OnPreRender="gdView_PreRender"&gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderText="FirstName"&gt; &lt;ItemTemplate &gt; &lt;asp:Label ID="lblFstName" runat="server" Text='&lt;%# Bind("FirstName") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText="LastName"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblLstName" runat="server" Text='&lt;%# Bind("LastName") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText="Organization"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblOrg" runat="server" Text='&lt;%# Bind("Organization") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre> <p>Here's my c# code for binding the gridview</p> <pre><code> List&lt;gdViewBAL&gt; lstgdviewBAL = new List&lt;gdViewBAL&gt;(); gdViewDAL clsgdViewDAL = new gdViewDAL(); DataTable dt = clsgdViewDAL.GetData(); if (dt.Rows.Count &gt; 0) { foreach (DataRow dRow in dt.Rows) { gdViewBAL clsgdviewBAL = new gdViewBAL(); clsgdviewBAL.Cellphone = dRow["CellPhone"].ToString(); clsgdviewBAL.Email = dRow["Email"].ToString(); clsgdviewBAL.Firstname = dRow["FirstName"].ToString(); clsgdviewBAL.Lastname = dRow["LastName"].ToString(); clsgdviewBAL.Organization = dRow["Organization"].ToString(); clsgdviewBAL.State1 = dRow["State1"].ToString(); clsgdviewBAL.Zip1 = dRow["Zip1"].ToString(); lstgdviewBAL.Add(clsgdviewBAL); } gdView.DataSource = lstgdviewBAL; gdView.DataBind(); gdView.UseAccessibleHeader = true; gdView.HeaderRow.TableSection = TableRowSection.TableHeader; gdView.FooterRow.TableSection = TableRowSection.TableFooter; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload