我不得不使用一些 jquery 将第一行转换为标题才能使其工作.示例如下:$(document).ready(function () {var $theadCols = $("#ContentPlaceHolder1_grdCashflow tr:first-child"),$table = $("#ContentPlaceHolder1_grdCashflow");//创建 thead 并附加 ;列$table.prepend("");$table.find("thead").append($theadCols);//初始化粘性头$table.floatThead();//$table = $("#ContentPlaceHolder1_grdCashflow");$table.dataTable({分页":假,订购":假,"dom":'<"top"fi>rt<"bottom"><"clear">'});});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.Can any one help me? 解决方案 i use jquery floatTheadhttp://mkoryak.github.io/floatThead/#introi 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">' } );}); 这篇关于冻结标题,滚动 GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-31 02:04