Freeze the header, scroll the GridView

后端 未结 1 1300
春和景丽
春和景丽 2020-12-07 01:59

How to freeze an Asp.net gridview header? I am trying to do it in different ways, but not able to.

I am using ASP 2.0 and VS 2010.<

相关标签:
1条回答
  • 2020-12-07 02:27

    i use jquery floatThead

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

    i had to use a bit of jquery to convert to first row to a thead for it to work.

    example below:

    $(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">'
        }
        );
    });
    
    0 讨论(0)
提交回复
热议问题