gridview用css固定表头失效,请帮助
gridview固定表头,原来使用网上介绍的css方法,原来一直用得好好的,引用到另外一个网站去,却用不了,固定表头功能失效,代码如下,请各位大侠帮忙看看
<%@ Page Language="VB" EnableEventValidation="false" AutoEventWireup="true" CodeFile="Tjkcx.aspx.vb" Inherits="Tjkcx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type ="text/javascript" src="WebControls/My97DatePicker/WdatePicker.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>选择产品</title>
<style>
.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>
<style>
.style1
{
width: 280px;
}
.style2
{
height: 2px;
width: 280px;
}
.style3
{
width: 78px;
}
.style4
{
width: 199px;
}
</style>
<script runat="server">
'第一行增加 EnableEventValidation="false" AutoEventWireup="true"
Protected Sub Dc_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Dc.Click
Response.Clear()
Response.Buffer = True
Response.Charset = "GB2312"
Response.AppendHeader("Content-Disposition", "attachment;filename=Detail.xls")
Response.ContentEncoding = System.Text.Encoding.UTF7
Response.ContentType = "application/ms-excel"
Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(oStringWriter)
Me.GV.RenderControl(oHtmlTextWriter)
Response.Output.Write(oStringWriter.ToString)
Response.Flush()
Response.End()
End Sub
Public Overloads Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
End Sub
</script>
</head>
<body style="width:auto " >
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Font-Overline="False" Font-Size="Small" Font-Underline="True"
ForeColor="Red" Style="z-index: 100; left: 0px; position: absolute; top: 0px"
Text="系统功能>>推荐卡查询" Width="144px"></asp:Label>
<asp:Panel ID="Panel1" runat="server" ScrollBars="Both" Style="z-index: 101;
left: 4px; position: absolute; top: 87px; height: 407px; width: 829px;">
<asp:GridView ID="GV" DataKeyNames="卡号" runat="server" AutoGenerateColumns="False" Height="144px"
Style="z-index: 100; left: 5px; position: absolute; top: 9px; width: 1373px;"
CellPadding="4" Font-Size="Small" ForeColor="#333333" AllowSorting="True">
<Columns>
<asp:TemplateField HeaderText="卡号">
<ItemTemplate>
<a href="<%# GetInfo(Eval("卡号")) %>"><%#Eval("卡号")%></a>
</ItemTemplate>
<ItemStyle Width="100px" Wrap="False" />
</asp:TemplateField>
<asp:BoundField DataField="姓名" HeaderText="姓名" >
<ItemStyle Width="50px" Wrap="False" />
</asp:BoundField>
<asp:BoundField HeaderText="币种" DataField="币种" >
<ItemStyle Width="50px" Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="余额" HeaderText="余额" >
<HeaderStyle HorizontalAlign="Right" />
<ItemStyle Width="80px" Wrap="False" HorizontalAlign="Right" />
</asp:BoundField>
<asp:BoundField DataField="透支利息" HeaderText="透支利息" >
<ItemStyle Wrap="False" HorizontalAlign="Right" Width="80px" />
</asp:BoundField>
<asp:BoundField DataField="贷款起息日" HeaderText="贷款起息日">
<ItemStyle Wrap="False" Width="80px" />
</asp:BoundField>
<asp:BoundField DataField="贷款超限日" HeaderText="贷款超限日">
<ItemStyle Wrap="False" Width="80px" />
</asp:BoundField>
<asp:BoundField DataField="透支天数" HeaderText="透支天数">
<ItemStyle HorizontalAlign="Right" Wrap="False" Width="70px" />
</asp:BoundField>
<asp:BoundField DataField="积分" HeaderText="积分">
<ItemStyle Wrap="False" HorizontalAlign="Right" Width="70px" />
</asp:BoundField>
<asp:BoundField DataField="受理网点" HeaderText="受理网点">
<ItemStyle Wrap="False" Width="50px" />
</asp:BoundField>
<asp:BoundField DataField="营销人" HeaderText="营销人">
<ItemStyle Wrap="False" Width="50px" />
</asp:BoundField>
<asp:BoundField DataField="推荐人" HeaderText="推荐人">
<ItemStyle Wrap="False" Width="50px" />
</asp:BoundField>
<asp:BoundField DataField="推荐金额" HeaderText="推荐金额">
<ItemStyle HorizontalAlign="Right" Width="50px" Wrap="False" />
</asp:BoundField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" CssClass="Freezing" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</asp:Panel>
<table style="border: thick solid red; z-index: 107; left: 8px; width: 804px; position: absolute; top: 24px; border-collapse: collapse; height: 57px; margin-bottom: 0px;">
<tr>
<td style="font-size: small; " class="style3">
受理网点</td>
<td class="style4">
<asp:DropDownList ID="Slwd" runat="server" Width="150px"
style="z-index: 103; left: 120px; top: 40px">
</asp:DropDownList>
</td>
<td style="font-size: small; " class="style3">
推荐人</td>
<td style="width: 199px; height: 2px">
<asp:DropDownList ID="Tjr" runat="server" Width="150px"
style="z-index: 100; left: 112px; top: 40px; "></asp:DropDownList>
</td>
<td style="font-size: small; " class="style3">
关键字</td>
<td style="font-size: small; " class="style1">
<asp:TextBox ID="Ssgjz" runat="server"
Style="z-index: 100; left: 464px; top: 0px" Width="119px"></asp:TextBox>
</td>
</tr>
<tr>
<td style="font-size: small; width: 78px; height: 2px">
营销人</td>
<td style="width: 199px; height: 2px">
<asp:DropDownList ID="Yxr" runat="server" Width="150px"
style="z-index: 100; left: 112px; top: 40px; "></asp:DropDownList>
</td>
<td style="font-size: small; width: 78px; height: 2px">
币种</td>
<td style="font-size: small; width: 78px; height: 2px">
<asp:DropDownList ID="Bz" runat="server" Width="100px"
style="z-index: 100; left: 112px; top: 40px; "></asp:DropDownList>
</td>
<td style="font-size: small; width: 78px; height: 2px">
</td>
<td class="style2">
<asp:Button ID="Cx" runat="server" Style="z-index: 100; left: 456px; top: 32px" Text="查询" Width="56px" />
<asp:Button ID="Dc" runat="server" Style="z-index: 100; left: 456px; top: 32px"
Text="导出" Width="54px" />
</td>
</tr>
</table>
<br />
<br />
</div>
</form>
</body>
</html>