【问题标题】:jQuery Bootgrid using ADO.Net with SQL Server 2012jQuery Bootgrid 使用 ADO.Net 和 SQL Server 2012
【发布时间】:2017-02-20 19:56:11
【问题描述】:

我读到 jQuery Bootgrid 很容易用于排序、分页和搜索选项,并看到了演示。谁能澄清我可以将这个 jQuery Bootgrid 用于我的 C# ASP.Net 应用程序。我正在使用与 ADO.Net 服务绑定的默认 GridView 选项。

我已经阅读了link 中的一篇文章,但它解释了 php 和 MySQL。是否适用于 ADO.Net 使用相同的概念。

请有人对此进行一些说明。

【问题讨论】:

    标签: jquery asp.net gridview ado.net jquery-bootgrid


    【解决方案1】:

    Bootgrid是一个jQuery插件,可以填充json数据,也可以自己构建htmltable(用trtd填充tbody的)。

    当然,您可以将它与 C# ASP.NET WebApplicationWebForms 或任何可以接收 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 已经填充了 trtd,这是一个加载 json 数据的示例。

    另一种选择是使用td's 手动构建行:

    <tbody>
        <tr>
            <td>10238</td>
            <td>eduardo@pingpong.com</td>
            <td>14.10.2013</td>
        </tr>
        ...
    </tbody>
    

    ...bootgrid 也能正常工作。

    使用 bootgrid 非常简单,只需阅读他们的examples here

    【讨论】:

      猜你喜欢
      • 2014-03-21
      • 1970-01-01
      • 2014-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-03
      • 2013-08-23
      相关资源
      最近更新 更多