我不得不修理表头当我向下滚动我想看到列标题直到记录结束。我做到了这一点,但我面临一个问题。我从数据库中获取数据,这是一个动态数据,所以当我在表格中显示布局变得很奇怪。因为如果有超过1000个单词的列将改变其宽度,而我提到了表格单元格宽度和百分比。我怎么能解决这个问题,头部仍然在顶部,并且布局不会受到任何数据干扰。我不想使用jQuery如何修复与垂直滚动中继器控制表的标题?
.gridScrollDiv
{
border:1px solid #CCCCCC;
height: 500px;
overflow: scroll;
overflow-x: hidden;
}
<div class="gridScrollDiv">
<table id="tblData" class="grid" style="width: 100%;" cellpadding="0">
<thead style="position:absolute;">
<tr>
<th style="width:40%;">
Code
</th>
<th style="width:40%;">
Description
</th>
<th style="width:20%;">
Date
</th>
</tr>
</thead>
<tbody>
<asp:Repeater ID="rptLoation" runat="server">
<ItemTemplate>
<tr>
<td style="width:40%; word-wrap:breake-word;">
<%# DataBinder.Eval(Container.DataItem, "Code")%>
</td>
<td style="width:40%; word-wrap:breake-word;">
<%# DataBinder.Eval(Container.DataItem, "Description")%>
</td>
<td style="width:20%; word-wrap:breake-word;">
<%# DataBinder.Eval(Container.DataItem, "RegistrationDate")%>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</tbody>
</table>
</div>
当你的问题是“请改变我的代码中加入此功能”,你的首要任务应该是张贴你想改变的代码。 – Alain 2012-04-09 12:48:56
@Alain你的意思是? – 2012-04-09 12:51:29