GridView固定表头

时间:2009-03-26    点击:2124   

<style>
 .Freezing
  {
    position:relative ;
    table-layout:fixed;
    top:expression(this.offsetParent.scrollTop);  
    z-index: 10;
  }

 .Freezing th{text-overflow:ellipsis;overflow:hidden;white-space: nowrap;padding:2px;}

</style>

    <div style="overflow-y: scroll; height:200px; width:auto; width:217px; " id="dvBody">   
       
          <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" CellPadding="5" Width="200px">
            <Columns>
           
              <asp:TemplateField HeaderText="序号">
                  <ItemTemplate> 
                      <%# Container.DataItemIndex + 1%> 
                    </ItemTemplate> 
              </asp:TemplateField>
                           
              <asp:BoundField DataField="username" HeaderText="UserName" />
              <asp:BoundField DataField="realname" HeaderText="RealName" />
            </Columns>
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" CssClass="Freezing"/>
        </asp:GridView>
   
   
    </div>

演示 下载

asp计算下载一个文件需要多长时间
GridView属性
GridView支持分页的自动编号
GridView求和求平均值
GridView合并表头
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 All Rights Reserved