【问题标题】:Fixed Header Gridview with scrollable body in asp.net修复了 asp.net 中带有可滚动正文的 Header Gridview
【发布时间】:2010-11-06 09:15:20
【问题描述】:

我在 div 内放置了一个网格视图,并且滚动条在那里。我想将网格视图标题设置为固定,并且在滚动时只有内容是可滚动的。 怎么可以这样...... 在此先感谢....

【问题讨论】:

标签: c# jquery asp.net .net


【解决方案1】:

在 C# 中 gridview 绑定后 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】:

    尝试执行以下操作。

    隐藏标题 配置 div,这样你就有了侧边栏 在 div 顶部添加另一个 div,包含列名

    不要忘记固定列大小,并让它们与顶部的列名相同。

    【讨论】:

      【解决方案3】:

      【讨论】:

        猜你喜欢
        • 2011-11-29
        • 2012-12-11
        • 1970-01-01
        • 2015-04-04
        • 2016-11-14
        • 2019-02-02
        • 1970-01-01
        • 2013-07-07
        • 2017-04-11
        相关资源
        最近更新 更多