DataGrid 滚动而表头不动

设置Css如下

  <style>
                .fixTitle { BACKGROUND: navy; COLOR: white; POSITION: relative; ; TOP: expression(this.offsetParent.scrollTop) }
        .scorllDataGrid { OVERFLOW-Y: scroll; HEIGHT: 300px }
        </style>

再在页面设置DataGrid属性

<div class="scorllDataGrid">
                        <asp:datagrid id="dgClassList" runat="server" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px"
                            BackColor="White" CellPadding="4" AutoGenerateColumns="False">
                            <FooterStyle ForeColor="#003399" BackColor="#99CCCC"></FooterStyle>
                            <SelectedItemStyle Font-Bold="True" ForeColor="#CCFF99" BackColor="#009999"></SelectedItemStyle>
                            <ItemStyle ForeColor="#003399" BackColor="White"></ItemStyle>
                            <HeaderStyle Font-Bold="True" ForeColor="#CCCCFF" CssClass="fixTitle" BackColor="#003399"></HeaderStyle>
                            <Columns>
                           
                            </Columns>
                            <PagerStyle HorizontalAlign="Left" ForeColor="#003399" BackColor="#99CCCC" Mode="NumericPages"></PagerStyle>
                        </asp:datagrid></div>

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页