可参考
http://forums.microsoft.com/msdn-cht/ShowPost.aspx?PostID=1293020&SiteID=14

解决方案 »

  1.   

    用css试试,我用的挺好。
    <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:1px;}
    </style> 
    然后在gridview的<HeaderStyle CssClass="Freezing" />中加上css就行了。
    <asp:GridView ID="GridView1" runat="server">
          <HeaderStyle CssClass="Freezing" />
        <Columns>
           ……    
        </Columns>
        <EmptyDataTemplate>
            <span style="font-size: 11pt; color: #ff3300">
            当前没有信息! </span>
        </EmptyDataTemplate>
    </asp:GridView>
      

  2.   

    用css试试,我用的挺好。
    <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:1px;}
    </style> 
    然后在gridview的<HeaderStyle CssClass="Freezing" />中加上css就行了。
    <asp:GridView ID="GridView1" runat="server">
          <HeaderStyle CssClass="Freezing" />
        <Columns>
           ……    
        </Columns>
        <EmptyDataTemplate>
            <span style="font-size: 11pt; color: #ff3300">
            当前没有信息! </span>
        </EmptyDataTemplate>
    </asp:GridView>
      

  3.   

    感谢楼上的兄台,这个方法已经能满足我的要求了但是我还有一个问题,就是我的GridView的Header的文字很长,能不能让它换行显示呢