我读过 jQuery Bootgrid 很容易用于排序、分页和搜索选项,并看到了演示。谁能澄清我可以将这个 jQuery Bootgrid 用于我的 C# ASP.Net 应用程序。我正在使用与 ADO.Net 服务绑定的默认 GridView 选项。
我已阅读此链接中的一篇文章,但它解释了 php 和 MySQL。是否适用于对 ADO.Net 使用相同的概念。
请有人对此有所了解。
Bootgrid is a jQuery plugin, which can be populated with json data, or you can build html table
by yourself (filling a tbody
with tr
's and td
's).
Surely you can use it with a C# ASP.NET WebApplication, or WebForms, or anything which can receive a http request, but it won't work binding to an ADO.NET, SQL Server Connection out of the box, as do GridView
, because a GridView
is a server-side component which is compiled and translated to html by the server. So the client receives only the resulted html, whereas Bootgrid is client-side, which means you can make it work with any kind of server application by using ajax calls.
You should build an API to receive requests from bootgrid, for example, or fill the html table data manually, as I said. The table must have their structure, like this sample:
<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>
In the sample above, they only configured the table header with column specifications, take note those data-column-id, data-type, data-anything attributes. They are bootgrid's common configurations.
In this example, we don't have a tbody
with tr
's and td
's already populated, it's a sample to be loaded with json data.
Another option is to manually build rows with td
's:
<tbody>
<tr>
<td>10238</td>
<td>eduardo@pingpong.com</td>
<td>14.10.2013</td>
</tr>
...
</tbody>
...and bootgrid will work as well.
It's really simple to use bootgrid, just take a read in their examples here.