摘要:asp.net 固定表頭加上捲軸
.Freezing
{
position: relative;
top: expression(this.offsetParent.scrollTop);
z-index: +2;
}
.Panel
{
position: relative;
z-index: 1;
top: 0px;
left: -1px;
}
</style>
<asp:Panel ID="Panel1" runat="server" Height="200px" CssClass="Panel">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" onrowdatabound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="流水號">
<ItemTemplate>
<asp:Label ID="Label1" runat="server"
Text='<%# (Container.DisplayIndex + 1) %>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="檔案下載">
<ItemTemplate>
<asp:LinkButton ID="LinkButton2" runat="server" Text='<%# Eval("url") %>'
onclick="LinkButton2_Click">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="Freezing" />
</asp:GridView>
</asp:Panel>