我浏览了很多固定标题网格视图的示例,并尝试了一些使用 div 和 java 脚本的选项。我没有从示例中工作的那个,这里有什么我想念的吗?
CSS
.gridViewHeader
{
background-color:Navy;
color:blue;
font-size:12px;
font-weight:bold;
position:relative;
z-index:10;
top:expression(<%= gv.HeaderRow %>.offsetParent.scrollTop-2);
}
design source
<table>
<tr>
<td>
</td>
</tr>
</table>
<div>
<asp:GridView ID="gv" runat="server" CellPadding="4" PageSize="50" RowHeaderColumn="True"
AllowPaging="True" BackColor="White" BorderColor="#3366CC" BorderStyle="None"
BorderWidth="1px" CssClass="gridViewHeader">
<PagerSettings Mode="NumericFirstLast" />
<PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" VerticalAlign="Middle" />
<RowStyle BackColor="White" ForeColor="#003399" BorderStyle="Inset" HorizontalAlign="Center"
VerticalAlign="Middle" Wrap="False" />
<SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
</asp:GridView>
</div>
<asp:HiddenField ID="hiddenfield1" runat="server" />
</asp:Content>