【发布时间】:2011-09-03 06:11:29
【问题描述】:
我在我的应用程序中使用 Gridview。网格视图通过一些标题文本与来自数据库的数据绑定。现在我想要的是当我滚动网格视图时我想在移动网格视图时显示标题我该怎么做
这是我写的McArthey
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="StyleSheet2.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="pnlWrapper" runat="server" Height="300px" ScrollBars="Vertical" BorderWidth="1px">
<asp:GridView ID="gvTheGrid" runat="server" GridLines="Both" CellPadding="3" CssClass="gvTable" AutoGenerateColumns="false" AllowSorting="true">
<columns>
<asp:BoundField DataField="id" HeaderText="id" HeaderStyle-Width="60" ItemStyle-Width="60" />
</columns>
</asp:GridView>
</asp:Panel>
</div>
</form>
</body>
</html>
stylesheet如下
TABLE.gvTable
{
table-layout:fixed;
}
TABLE.gvTable TH
{
position:relative;
border-top-width:0px;
border-bottom-color:Black;
background-color:#F5DEB3;
}
这是我运行并单击查看源代码时的示例源代码
<div id="pnlWrapper" style="border-width:1px;border-style:solid;height:300px;overflow-y:scroll;">
<div>
<table class="gvTable" cellspacing="0" cellpadding="3" rules="all" border="1" id="gvTheGrid" style="border-collapse:collapse;">
<tr>
<th scope="col" style="width:60px;">id</th>
</tr><tr>
<td style="width:60px;">10</td>
</tr><tr>
<td style="width:60px;">10</td>
</tr><tr>
<td style="width:60px;">10</td>
</tr><tr>
页面加载时显示的标题
向下滚动时没有标题
【问题讨论】:
-
无法查看或下载内容使用我该怎么办
标签: c# asp.net gridview .net-2.0