固定头网格视图ASP.NET [英] Fixed Header Grid View ASP.NET

查看:116
本文介绍了固定头网格视图ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过大量的固定头部网格视图的例子走了,并试图采用div和Java脚本的几个选项。一个我因此未从工作的例子,有什么我错过这里。

  CSS
.gridViewHeader
{
     背景色:海军;
    颜色:蓝色;
    字体大小:12像素;
    字体重量:大胆的;
    位置:相对;
    的z-index:10;
   顶部:前pression(小于(%)= gv.HeaderRow%GT; .offsetParent.scrollTop-2);
}设计源
<表>
&所述; TR>
            &所述; TD>
                &安培; NBSP;
            < / TD>
        < / TR>
    < /表>
    < D​​IV>
        < ASP:GridView控件ID =GV=服务器的cellpadding =4每页=50RowHeaderColumn =真
            AllowPaging =真背景色=白BORDERCOLOR =#3366CC边框=无
            边框宽度=1像素的CssClass =gridViewHeader>
            < PagerSettings模式=NumericFirstLast/>
            < PagerStyle背景色=#99CCCC前景色=#003399Horizo​​ntalAlign =左VerticalAlign =中/>
            < RowStyle背景色=白前景色=#003399边框=插图Horizo​​ntalAlign =中心
                VerticalAlign =中自动换行=FALSE/>
            < SelectedRowStyle背景色=#009999FONT-粗体=真前景色=#CCFF99/>
        < / ASP:GridView的>
    < / DIV>
        < ASP:HiddenField ID =hiddenfield1=服务器/>
    < / ASP:内容>


解决方案

这的CSS将解决您的问题:

  .GVFixedHeader {字体重量:大胆的;背景颜色:绿色;位置:相对;
             顶部:前pression(this.parentNode.parentNode.parentNode.scrollTop-1);}

I gone through lots of examples for fixed header grid view, and tried few options using div and java scripts. the one i didnot work from the example, is there anything i miss here.

 CSS 
.gridViewHeader
{
     background-color:Navy;
    color:blue;
    font-size:12px;
    font-weight:bold;
    position:relative;
    z-index:10;
   top:expression(<%= gv.HeaderRow %>.offsetParent.scrollTop-2);
}

design source
<table>
<tr>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    <div>
        <asp:GridView ID="gv" runat="server" CellPadding="4" PageSize="50" RowHeaderColumn="True"
            AllowPaging="True" BackColor="White" BorderColor="#3366CC" BorderStyle="None"
            BorderWidth="1px" CssClass="gridViewHeader">
            <PagerSettings Mode="NumericFirstLast" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" VerticalAlign="Middle" />
            <RowStyle BackColor="White" ForeColor="#003399" BorderStyle="Inset" HorizontalAlign="Center"
                VerticalAlign="Middle" Wrap="False" />
            <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        </asp:GridView>
    </div>
        <asp:HiddenField ID="hiddenfield1" runat="server"  />
    </asp:Content>

解决方案

This CSS will fix your problem:

.GVFixedHeader { font-weight:bold; background-color: Green; position:relative; 
             top:expression(this.parentNode.parentNode.parentNode.scrollTop-1);}

这篇关于固定头网格视图ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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