惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
N
Netflix TechBlog - Medium
Google Online Security Blog
Google Online Security Blog
月光博客
月光博客
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
M
MIT News - Artificial intelligence
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
Apple Machine Learning Research
Apple Machine Learning Research
aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
The Cloudflare Blog
Blog — PlanetScale
Blog — PlanetScale
F
Full Disclosure
G
Google Developers Blog
罗磊的独立博客
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
A
About on SuperTechFans
IT之家
IT之家
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
有赞技术团队
有赞技术团队
GbyAI
GbyAI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
The Register - Security
The Register - Security
U
Unit 42
D
Docker
Martin Fowler
Martin Fowler
L
LINUX DO - 热门话题
NISL@THU
NISL@THU
阮一峰的网络日志
阮一峰的网络日志
C
Cybersecurity and Infrastructure Security Agency CISA
博客园_首页
Google DeepMind News
Google DeepMind News

博客园 - Bobby

SQL Top注意事项 asp.net回车提交表单 - Bobby - 博客园 C#关于值类型和引用类型 Asp.Net XML操作基类(修改,删除,新增,创建) 项目中的代码 客户端全部选中或取消Repeater中的CheckBox - Bobby - 博客园 javascript技巧参考(转载) js倒计时关闭窗口&计算字数 - Bobby - 博客园 经典算法-C#四种排序算法 js设置调用cookie设置背景颜色 字号、颜色 js简繁转换代码 ASP.NET错误处理的方式(总结) ASP.NET错误处理和程序优化 学习SQL应知道的动态SQL语句基本语法 js宝典学习笔记【转载】 在b/s开发中经常用到的javaScript技术整理 Visual C#常用函数和方法集汇总 SQL SERVER 与ACCESS、EXCEL的数据转换 - Bobby 不被浏览器屏蔽的对联广告
CSS控制GridView固定表头 - Bobby - 博客园
Bobby · 2007-04-29 · via 博客园 - Bobby

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:2px;}
</style>

调用代码

     <div style="overflow-y: scroll; height: 200px; width: 300px">    <!--设置Div带滚动条-->
            
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3"
                BackColor
="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
                Font-Size
="12px" DataKeyNames="ProductID" DataSourceID="SqlDataSource1" AllowSorting="True">
                
<FooterStyle BackColor="White" ForeColor="#000066" />
                
<Columns>
                    
<asp:CommandField ShowSelectButton="True" />
                    
<asp:BoundField DataField="ProductID" HeaderText="ProductID" ReadOnly="True" SortExpression="ProductID" />
                    
<asp:BoundField DataField="SupplierID" HeaderText="SupplierID" SortExpression="SupplierID" />
                    
<asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
                    
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID" SortExpression="CategoryID" />
                
</Columns>
                
<RowStyle ForeColor="#000066" />
                
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" CssClass="ms-formlabel DataGridFixedHeader" />
                
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" CssClass="Freezing" /></asp:GridView>
<!--调用样式固定表头-->

        
</div>