I'm trying to incorporate a grid/table in my html5 page populated with data from sql server using razor. I am a complete and absolute newbie. My page works and the SQL query works. Last thing I need is to get the table to look and behave like the basic bootgrid example here: http://www.jquery-bootgrid.com/Examples#basic
I've done the following:
- Created a new cshtml page/site and installed Bootstrap, jquery and the jquery bootgrid using the Nuget package manager.
- Added references to these js and css files from html page's head section.
- Created a html table and populated with data from SQL Server
- Formatted the table using bootstrap. Up to here, everything works.
Now I cannot get any of bootgrid look and feel to activate. I've gone through the "documentation" page on the bootgrid website and even copied one of the samples off their site but nothing works.
On stackoverflow, I did a search and found the following three posts that kind of relates to my problem but didn't lead me to any solutions.
- Display datatable at view with possibility of edit/add elements
- Best Datagrid for Bootstrap/jQuery?
- bootgrid not showing data
I must be missing some step or something that activates the bootgrid functionality.
Here is my basic CSHTML page I'm using to test/learn bootgrid:
<html lang="en">
<head>
<meta charset="utf-8" />
<title>My Site's Title</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="~/Content/bootstrap.min.css">
<link rel="stylesheet" href="~/Content/jquery.bootgrid.min.css">
<script src="~/Scripts/jquery-1.11.2.min.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
<script src="~/Scripts/jquery.bootgrid.min.js"></script>
</head>
<body>
<!--jQuery Bootgrid-->
<div class="container">
<h1>JQuery Bootgrid</h1>
<table id="grid-basic" class="table table-bordered table-hover table-striped table-condensed" data-toggle="bootgrid">
<thead>
<tr class="active">
<th data-column-id="id" data-type="numeric" data-identifier="true">Group ID</th>
<th data-column-id="group_name" data-order="desc">Group Name</th>
<th data-column-id="group_desc">Group Description</th>
</tr>
</thead>
<tbody>
@foreach(var xrow in selectedData){
<tr>
<td>@xrow.GroupID</td>
<td>@xrow.GroupName</td>
<td>@xrow.GroupDesc</td>
</tr>
}
</tbody>
</table>
</div>
</body>`
</html>
What am I missing?
Many thanks