Manoj Maharana

Manoj Maharana

  • NA
  • 362
  • 128.6k

Bind data and display datatable on aspx page using Jquery in

Jul 8 2016 11:46 AM
Here is my HTML table:
<table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th>Check Box</th> <th>Category Name</th> <th>Category Details</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <tr> <td>Other browsers</td> <td>All others</td> <td>yes</td> <td>for</td> <td>Ummm</td> </tr> </tbody> </table>
I have already bound the HTML table using jQuery. Here is my jQuery code:
$(document).ready(function() { debugger     $.ajax({         type: "POST",         contentType: "application/json; charset=utf-8",         url: "WebForm5.aspx/BindDatatable",         data: "{}",         dataType: "json",         success: function (dt) { for (var i = 0; i < dt.d.length; i++) {                 $("#example1").append("<tr><td> <input type='checkbox' /></td><td>" + dt.d[i].CategoryID + "</td><td>" + dt.d[i].Name + "</td><td>" + dt.d[i].description + "</td><td> <button type='submit'>Submit</button></td></tr>"); } },         error: function (result) {             alert("Error"); } }); });
My problem is that the table is binding at <thead> not at <tbody> thats why jQuery paging, searching, sorting is not working. I Want to bind at <tbody>. What is wrong with my code? Can anyone help me out?
i am using this link:http://www.aspdotnet-suresh.com/2012/03/bind-data-and-display-datatable-on-aspx.html 

Answers (2)