I created a new MVC 4 web project (VS 2012 Express) and installed the Twitter Bootstrap package:
PM> Install-Package twitter.bootstrap.mvc4
Seems to be ok, but I needed to add DataTables (http://www.datatables.net/) but can’t seem to get it to work.
I edited the _BootstrapLayout.basic.cshtml file to include the datatables js:
<link href="@Styles.Url("~/Content/css-responsive")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.8.3.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.dataTables.js")" type="text/javascript"></script>
@RenderSection("head", required: false)
@Html.Partial("_html5shiv")
in my View i have added:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable();
} );
</script>
and set the ID of the Table to “example”
It doesn’t seem to be working though… the view was autogenerated by Visual Studio so i have also added the tags to the table…
It looks like it was a problem with including the JS files.
_BootstrapLayout.basic.cshtml had:
when it should have been
This solved the problem.