[总结]DataGrid 固定表头实现(纵向和横向滚动条滚动,而Header不动)
生活随笔
收集整理的這篇文章主要介紹了
[总结]DataGrid 固定表头实现(纵向和横向滚动条滚动,而Header不动)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.用Css來定制DataGrid表頭HeaderStyle的cssclass屬性
.fixTitle
{
?/*background: navy;
?color: white;*/
?position: relative;
?top: expression(this.offsetParent.scrollTop);
}
?
?2????????????????ms_positioning="GridLayout">
?3????????????????<asp:DataGrid?id="DataGrid1"?style="Z-INDEX:?103;"?runat="server"?BorderColor="#DEBA84"?BorderStyle="None"
?4????????????????????BorderWidth="1px"?BackColor="#DEBA84"?CellPadding="0">
?5????????????????????<SelectedItemStyle?Font-Bold="True"?ForeColor="White"?BackColor="#738A9C"></SelectedItemStyle>
?6????????????????????<ItemStyle?ForeColor="#8C4510"?BackColor="#FFF7E7"></ItemStyle>
?7????????????????????<HeaderStyle?Font-Bold="True"?ForeColor="White"?CssClass="fixTitle"?BackColor="#A55129"></HeaderStyle>
?8????????????????????<FooterStyle?ForeColor="#8C4510"?BackColor="#F7DFB5"></FooterStyle>
?9????????????????????<PagerStyle?HorizontalAlign="Center"?ForeColor="#8C4510"?Mode="NumericPages"></PagerStyle>
10????????????????</asp:DataGrid></DIV>
注意DataGrid的position不能是絕對位置!
2.孟大哥的方法
http://dotnet.aspx.cc/ShowDetail.aspx?id=B3F3462D-DC34-41CE-9FEE-6965B2A3D1AD
轉載于:https://www.cnblogs.com/goody9807/archive/2005/08/15/215320.html
總結
以上是生活随笔為你收集整理的[总结]DataGrid 固定表头实现(纵向和横向滚动条滚动,而Header不动)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 招行天猫营业厅联名信用卡额度是多少 想申
- 下一篇: 要回家了,想到以后..