How to pimp the html table which is dynamicially added

How to pimp the html table which is dynamicially added

beckstar101beckstar101 Posts: 1Questions: 1Answers: 0
edited May 2015 in Free community support

I use a bootrtrap temlplate for my asp.net webforms project. I copy and pasted the datatable section into my aspx page. After that I deleted the hardcoded table <Table>................</table>

instead I created the table in the codebehind:

Dim x3 As XmlElement = SearchService.FindAddressesBySearchtext(login, pass,Einschlitz.Text.ToString, False)
``` Dim test As String = ConvertxmlToHTML(table1)

datatableDIV.InnerHtml = test Page.ClientScript.RegisterStartupScript(Me.GetType, "table_function", "functiontest();", True)

As you see, the variable test is placed placed into the

<

div class="box-body" id="datatablediv" runat="server">
by datatablediv.InnerHtml = test
After that I call the functiontest() Javacscript Method shown at the end of the thread.
here is the containter from my aspx page


Data Tables
advanced tables
  1. Home
  2. Tables
  3. Data tables

Data Table With Full Features

<!-- /.content-wrapper''' This is the function which gets called in the original template where the table is hardcoded, ''' $(function () { $("#example1").dataTable(); $('#example2').dataTable({ "bPaginate": true, "bLengthChange": false, "bFilter": false, "bSort": true, "bInfo": true, "bAutoWidth": false }); });

I changed it to :

``` <script type="text/javascript">
function functiontest() {
alert('Function called successfully!');
$('#Datatable1').dataTable({
"bPaginate": true,
"bLengthChange": false,
"bFilter": false,
"bSort": true,
"bInfo": true,
"bAutoWidth": false
});

             }
           </script>```

The html table I insert looks like exactly the same as the one which was hardcoded. But all the options like sorting the rows, searching for a special row in via a textbox,the pagination, all is missing. I dont know why, and I dont know how to add it correctly. Can you help out?

This discussion has been closed.