c# - Display datatable at view with possibility of edit/add elements -
how can display datatable @ view possibility of edit/add elements?
i pass datatable
object view
, , need code can display table @ page, possibility of edit_add elements
you can using jquery bootgrid (http://www.jquery-bootgrid.com/)
lets say, datatable has 2 column.
here view:
<table id="grid-basic"> <thead> <tr> <th data-column-id="id"> header1 </th> <th data-column-id="name"> header2 </th> <th data-column-id="link" data-formatter="link" data-sortable="false">header3</th> </tr> </thead> <tbody> <tr> <td> value1 </td> <td> value2 </td> <td></td> // make empty display option (edit, delete) </tr> </tbody> </table>
here javascript:
<script> $("#grid-basic").bootgrid({ formatters: { "link": function (column, row) { //var rowid = row.id.trim(); return "<a href=\"yoururlforedit\"><button value=\"edit\"></button></a> <a href=\"yoururlfordelete\"><button value=\"delete\"></button></a>"; } } }); </script>
Comments
Post a Comment