jquery - DataTables warning: Requested unknown parameter `0` for row 0 -
i using vb.net. use dynamic datatable can search, list, update , delete data. datatable works without issue. there 1 problem. when make page includes datatables refresh, popup error this.

<form style =" margin-top : 220px;" id="form2" runat="server"> <table id="liste" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>sil</th> <th>düzenle</th> <th>proje referans numarası</th> <th>proje adı</th> <th>proje detay</th> <th>kullanacak olan departman</th> <th>başlangıç tarihi</th> <th>başlangıç saati</th> <th>bitiş tarihi</th> <th>bitiş saati</th> </tr> </thead> <tfoot> <tr> <th>sil</th> <th>düzenle</th> <th>proje referans numarası</th> <th>proje adı</th> <th>proje detay</th> <th>kullanacak olan departman</th> <th>başlangıç tarihi</th> <th>başlangıç saati</th> <th>bitiş tarihi</th> <th>bitiş saati</th> </tr> </tfoot> <tbody> <tr> <%dim strbaglanti string = "data source=127.0.0.1;initial catalog=yotk_test;persist security info=true;user id=username;password=password" dim sayac = 0 dim cn new system.data.sqlclient.sqlconnection(strbaglanti) dim strq string = "select * proje" dim cmd new system.data.sqlclient.sqlcommand(strq, cn) cn.open() dim reader system.data.sqlclient.sqldatareader = cmd.executereader() while reader.read response.write("<tr><td><center><a href='delete_project.aspx?id=" + reader("id").tostring() + "'><img width = '52px' height = '52px' src='css/images/delete.png'/></a></center></td><td><center><a href='edit_project.aspx?id=" + reader("id").tostring() + "'><img width = '52px' height = '52px' src='css/images/edit.png'/></a></center></td><td><center>" + reader("id").tostring + "</center></td><td><center>" + reader("projeadi").tostring + "</center></td><td><center><textarea style='width : 300px; height:100px;'>" + reader("projeaciklama").tostring + "</textarea></center></td><td><center>" + reader("departman").tostring + "</center></td><td><center>" + reader("baslangictarihi").tostring + "</center></td><td><center>" + reader("baslangicsaati").tostring + "</center></td><td><center>" + reader("bitistarihi").tostring + "</center></td><td><center>" + reader("bitissaati").tostring + "</center></td></tr>") loop cn.close() %> </tr> </tbody> </table> </form> this table code
<script src="http://cdn.datatables.net/plug-ins/1.10.7/integration/jqueryui/datatables.jqueryui.js"></script> <script> $(document).ready(function() { $('#liste').datatable(); } ); </script> this javascript code. problem?
according datatables manual, 1 of reasons can occur is:
- the number of cells in table not satisfy equation
#cells = #columns * #rows(i.e. there more columns defined in header in table body, or vice-versa).
you have <tr></tr> defined outside of vb code. below corrected code other parts omitted brevity.
<tbody> <%dim strbaglanti string = "data source=127.0.0.1;initial catalog=yotk_test;persist security info=true;user id=username;password=password" dim sayac = 0 dim cn new system.data.sqlclient.sqlconnection(strbaglanti) dim strq string = "select * proje" dim cmd new system.data.sqlclient.sqlcommand(strq, cn) cn.open() dim reader system.data.sqlclient.sqldatareader = cmd.executereader() while reader.read response.write("<tr><td><center><a href='delete_project.aspx?id=" + reader("id").tostring() + "'><img width = '52px' height = '52px' src='css/images/delete.png'/></a></center></td><td><center><a href='edit_project.aspx?id=" + reader("id").tostring() + "'><img width = '52px' height = '52px' src='css/images/edit.png'/></a></center></td><td><center>" + reader("id").tostring + "</center></td><td><center>" + reader("projeadi").tostring + "</center></td><td><center><textarea style='width : 300px; height:100px;'>" + reader("projeaciklama").tostring + "</textarea></center></td><td><center>" + reader("departman").tostring + "</center></td><td><center>" + reader("baslangictarihi").tostring + "</center></td><td><center>" + reader("baslangicsaati").tostring + "</center></td><td><center>" + reader("bitistarihi").tostring + "</center></td><td><center>" + reader("bitissaati").tostring + "</center></td></tr>") loop cn.close() %> </tbody>
Comments
Post a Comment