gridview显示问题
如何创建表头固定,表体可滚动的GridView!
以下代码显示时,表头不见了
<script runat= "server ">
protected void Page_Load( object sender, EventArgs e )
{
if (!IsPostBack)
{
GridView1.Attributes.Add( "style ", "table-layout:fixed ");
GridView1.DataSource = dt.DefaultView;
//dt已经绑定数据源!
GridView1.DataBind();
}
}
</script>
<script type= "text/javascript ">
function s()
{
var t = document.getElementById( " <%=GridView1.ClientID%> ");
var t2 = t.cloneNode(true)
for(i = t2.rows.length -1;i > 0;i--)
t2.deleteRow(i)
t.deleteRow(0)
a.appendChild(t2)
}
window.onload = s
</script>
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<title> 创建表头固定,表体可滚动的GridView </title>
</head>
<body>
<form id= "Form1 " runat= "server ">
<table>
<tr>
<td>
<div id= "a ">
</div>
<div style= "overflow-y: scroll; height: 200px ">
<asp:GridView ID= "GridView1 " runat= "server " Font-Size= "12px " BackColor= "#FFFFFF "