冻结标题,滚动GridView

Ind*_*dra 8 asp.net

如何冻结Asp.net gridview标题?我试图以不同的方式做到这一点,但不能.

我正在使用ASP 2.0和VS 2010.

谁能帮我?

小智 0

我使用 jquery floatThead

http://mkoryak.github.io/floatThead/#intro

我必须使用一些 jquery 将第一行转换为标题才能工作。

下面的例子:

$(document).ready(function () {
    var $theadCols = $("#ContentPlaceHolder1_grdCashflow  tr:first-child"),
        $table = $("#ContentPlaceHolder1_grdCashflow");

    // create thead and append <th> columns
    $table.prepend("<thead/>");
    $table.find("thead").append($theadCols);

    // init stickyHeader
    $table.floatThead();

    //$table = $("#ContentPlaceHolder1_grdCashflow");
    $table.dataTable(
    {
        "paging": false,
        "ordering": false,
        "dom":'<"top"fi>rt<"bottom"><"clear">'
    }
    );
});
Run Code Online (Sandbox Code Playgroud)