在asp.net中修复了带有可滚动主体的Header Gridview

时间:2010-11-06 09:15:20

标签: c# jquery asp.net .net

我在div中放置了一个网格视图,滚动条就在那里。我想固定网格视图标题,而滚动时只有内容可滚动。 怎么能这样.... 在此先感谢....

3 个答案:

答案 0 :(得分:1)

尝试执行以下操作。

隐藏标题 配置div,所以你有侧栏 在div上添加另一个div,列名为

不要忘记修改列大小,并使它们与顶部的列名相同。

答案 1 :(得分:1)

在gridview绑定后的C#中 GVBrand.HeaderRow.TableSection = TableRowSection.TableHeader;

在gridview中添加以下css

    table {
        width: 100%;
    }

    thead, tbody, tr, td, th { display: block; }

    tr:after {
        content: ' ';
        display: block;
        visibility: hidden;
        clear: both;
    }

    thead th {
        height: 30px;

        /*text-align: left;*/
    }

    tbody {
        height: 120px;
        overflow-y: auto;
    }

    thead {
        /* fallback */
    }


    tbody td, thead th {
        width: 19.2%;
        float: left;
    }

http://jsfiddle.net/T9Bhm/7/

答案 2 :(得分:0)