1. Use CSS to customize the cssclass attribute of the DataGrid header headerstyle
. Fixtitle
{
/* Background: Navy;
Color: White ;*/
Position: relative;
Top: expression (this. offsetparent. scrolltop );
}
1 < Div Style = "Z-INDEX: 102; left: pixel PX; overflow: auto; width: 184px; top: 128px; Height: 216px"
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 >
Note that the position of the DataGrid cannot be an absolute position!
2. Meng's approach
Http://dotnet.aspx.cc/ShowDetail.aspx? B3F3462D-DC34-41CE-9FEE-6965B2A3D1AD