冻结标题,滚动 GridView [英] Freeze the header, scroll the GridView

查看:24
本文介绍了冻结标题,滚动 GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何冻结 Asp.net gridview 标头?我正在尝试以不同的方式执行此操作,但无法做到.

我使用的是 ASP 2.0 和 VS 2010.

有人可以帮我吗?

解决方案

我使用 jquery floatThead

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

我不得不使用一些 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 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">'
    }
    );
});

这篇关于冻结标题,滚动 GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆