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>

阅读更多
上一篇去掉/禁止系统菜单里的MOVE的方法 (Winform)
下一篇C#中为DataGrid添加下拉列表框 WinForm
想对作者说点什么? 我来说一句

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

关闭
关闭
关闭