Bruce Xiao 的程序生活

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
DataGrid列头固定并不需要非常麻烦,在我看来,只需要写一个样式即可。
<style type="text/css">
  .FixedHead
  {
   position:relative;
   top:expression(this.offsetParent.scrollTop);
  }
  .FixedDiv
  {
   height:100px;
   overflow-y:scroll;
   }
</scyle>
然后在DataGrid的<headerStyle>里引用此样式
<div class="FixedDiv">
<asp:DataGrid id="dgTest" runat="server"  CellPadding="4">
  <HeaderStyle Font-Bold="True" ForeColor="#FFFFCC" CssClass="FixedHead" BackColor="#990000"></HeaderStyle>
 </asp:DataGrid>
</div>
posted on 2006-10-11 18:50  Bruce Xiao  阅读(329)  评论(0编辑  收藏  举报