日期:2014-05-17  浏览次数:20569 次

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>
  &nbsp;
  <asp:Panel ID="Panel1" runat="server" ScrollBars="Both" Style="z-index: 101;
  left: 4px; position: absolute; top: 87px; heig