I donwload jQuery Datatable and the files I put it in my wwwroot
folder. This is the structure of wwwroot
folder:
-wwwroot
-css
-DataTable
-DataTables-1.10.21
-css
-images
-js
-datatables.css
-datatables.js
-IMG
-js
-lib
In my _Layout.cshtml
I inserted :
<link rel="stylesheet" href="~/DataTable/datatables.css" />
<script type="text/javascript" charset="utf8" src="~/DataTable/datatables.js"></script>
to use jQuery Datatable.
But I can't use it in my view page. This is what I try to do in my view page :
*<table class="table table-hover" id="tblmissioni">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Nome)
</th>
.....
</tr>
</thead>
<script>
$(document).ready(function () {
$("#tblmissioni").DataTable(
{
"ajax": {
"url": "/Missioni/Missioni",
"type": "GET",
"datatype": "json"
},
"columns": [
{ "data": "asdasd" },
{ "data": "asdasd" },
{ "data": "asdasd" },
{ "data": "asdasd" },
{ "data": "asdasd" },
{ "data": "asdasd" },
{ "data": "asdasd" },
---I have 45 colums----
]
});
}
</script>*
Is it correct to do like this or not? I don't know if my <link>
and <script>
are correct in _Layout.cshtml
Any suggestions how to fix this?
Thanks in advance!