Bootgrid是一个jQuery插件,可以填充json数据,也可以自己构建htmltable(用tr和td填充tbody的)。
当然,您可以将它与 C# ASP.NET WebApplication 或 WebForms 或任何可以接收 http 请求的东西一起使用,但它无法绑定到开箱即用的 ADO.NET、SQL Server 连接,GridView 也是如此,因为 GridView 是一个服务器端组件,它被编译并翻译为html 由服务器提供。所以客户端只接收生成的 html,而 Bootgrid 是客户端,这意味着您可以通过使用 ajax 调用使其与任何类型的服务器应用程序一起工作。
您应该构建一个 API 来接收来自 bootgrid 的请求,或者如我所说的手动填充 html 表数据。该表必须具有它们的结构,如以下示例:
<table id="grid-data" class="table table-condensed table-hover table-striped">
<thead>
<tr>
<th data-column-id="id" data-type="numeric">ID</th>
<th data-column-id="sender">Sender</th>
<th data-column-id="received" data-order="desc">Received</th>
<th data-column-id="link" data-formatter="link" data-sortable="false">Link</th>
</tr>
</thead>
</table>
在上面的示例中,他们只为表头配置了列规范,注意那些 data-column-id、data-type、data-anything 属性。它们是 bootgrid 的常用配置。
在这个例子中,我们没有 tbody 已经填充了 tr 和 td,这是一个加载 json 数据的示例。
另一种选择是使用td's 手动构建行:
<tbody>
<tr>
<td>10238</td>
<td>eduardo@pingpong.com</td>
<td>14.10.2013</td>
</tr>
...
</tbody>
...bootgrid 也能正常工作。
使用 bootgrid 非常简单,只需阅读他们的examples here。