How to set each item of a asp:CheckBoxList to seperate row of a bootstrap datatable ASP.NET -


i have asp:checkboxlist .aspx page. want each item of asp:checkboxlist seperate row of bootstrap datatable. code below

<asp:table id="tblusertorolelist">    <thead>       <tr>        <th>           role list         </th>         <th></th>       </tr>    </thead>    <tbody>       <tr>          <td>            <asp:checkboxlist id="chkrolelist" runat="server" width="250px"></asp:checkboxlist>          </td>          <td></td>       </tr>     </tbody> 

and output enter image description here

here items in under 1 td of single tr

but need items separate tr can search items bootstrap datatable's default search box

please me

the <asp:checkboxlist> generates html table.the problem table doesn't have <th> elements defined , bootstrap datatable requires these tags present.

solution?manually add <th> tags before calling datatable();

<head runat="server">     <title></title>     <link href="https://cdn.datatables.net/1.10.12/css/jquery.datatables.min.css" rel="stylesheet" />      <script src="//code.jquery.com/jquery-1.12.3.min.js"></script>     <script src="https://cdn.datatables.net/1.10.12/js/jquery.datatables.min.js"></script>     <script type="text/javascript">         $(function () {             debugger;             $("<thead><tr><th>roles</th></tr><thead>").insertbefore("#chkrolelist tbody");             $('#chkrolelist').datatable();         });     </script> </head> <body>     <form id="form1" runat="server">         <asp:checkboxlist id="chkrolelist" runat="server" width="250px"></asp:checkboxlist>     </form> </body> 

output: bootstrap datatable searching


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -