Gridview固定列

http://blog.csdn.net/Samanthaqu/archive/2007/12/04/1915667.aspx
大鸟 14:18:00
样式表
.fixColleft
{ z-index:120; left:  expression(this.offsetParent.scrollLeft);  position:  relative }
    .fixedHeader {
      overflow: auto;}
.fixColleft 
{ }

后台代码:
绑定gridview
this.GridView1.Columns[0].HeaderStyle.CssClass = "fixColleft";
this.GridView1.Columns[1].HeaderStyle.CssClass = "fixColleft";
this.GridView1.Columns[0].ItemStyle.CssClass = "fixColleft";
this.GridView1.Columns[1].ItemStyle.CssClass = "fixColleft";
this.GridView1.DataBind();
大鸟 14:21:46
在页面样式加入:

<style type="text/css">
     .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>


在GridView属性里加入

<HeaderStyle CssClass="Freezing"/>

posted @ 2009-05-09 14:42  iLove.Net  阅读(1269)  评论(0编辑  收藏  举报