zoukankan      html  css  js  c++  java
  • 用CSS实现DataGird滚动而表头不动

    样式:

    <style> .fixTitle { BACKGROUND: navy; COLOR: white; POSITION: relative; ; TOP: expression(this.offsetParent.scrollTop) } 
     .scorllDataGrid 
    { OVERFLOW-Y: scroll; HEIGHT: 300px }
     </style>
    Html
    <body MS_POSITIONING="GridLayout">
            
    <form id="Form1" method="post" runat="server">
                
    <div class="scorllDataGrid" style="WIDTH: 696px; HEIGHT: 300px">
                    
    <asp:datagrid id="dgClassList" runat="server" Width="688px" AutoGenerateColumns="False" CellPadding="4"
                        BackColor
    ="White" BorderWidth="1px" BorderStyle="None" BorderColor="#CC9966">
                        
    <FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
                        
    <SelectedItemStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedItemStyle>
                        
    <ItemStyle ForeColor="#330099" BackColor="White"></ItemStyle>
                        
    <HeaderStyle Font-Bold="True" ForeColor="#FFFFCC" CssClass="fixTitle" BackColor="#990000"></HeaderStyle>
                        
    <Columns>
                            
    <asp:BoundColumn DataField="RequirementID" HeaderText="流水号">
                                
    <HeaderStyle Wrap="False"></HeaderStyle>
                            
    </asp:BoundColumn>
                            
    <asp:BoundColumn DataField="RequirementNo" HeaderText="编号">
                                
    <HeaderStyle Wrap="False"></HeaderStyle>
                            
    </asp:BoundColumn>
                            
    <asp:BoundColumn DataField="Name" HeaderText="需求名称">
                                
    <HeaderStyle Wrap="False"></HeaderStyle>
                            
    </asp:BoundColumn>
                            
    <asp:BoundColumn DataField="userName" HeaderText="提出人">
                                
    <HeaderStyle Wrap="False"></HeaderStyle>
                            
    </asp:BoundColumn>
                        
    </Columns>
                        
    <PagerStyle HorizontalAlign="Center" ForeColor="#330099" BackColor="#FFFFCC"></PagerStyle>
                    
    </asp:datagrid>
                
    </div>
            
    </form>
        
    </body>
    效果图:
  • 相关阅读:
    修复 Visual Studio Error “No exports were found that match the constraint”
    RabbitMQ Config
    Entity Framework Extended Library
    Navisworks API 简单二次开发 (自定义工具条)
    NavisWorks Api 简单使用与Gantt
    SQL SERVER 竖表变成横表
    SQL SERVER 多数据导入
    Devexpress GridControl.Export
    mongo DB for C#
    Devexress XPO xpPageSelector 使用
  • 原文地址:https://www.cnblogs.com/vaiyanzi/p/605863.html
Copyright © 2011-2022 走看看