直接看asp範例
<%@ Language=VBScript %><%xcnt = 50ycnt = 60%><HTML><HEAD><META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"><style type="text/css"> .FixedTitleRow { position: relative; top: expression(this.offsetParent.scrollTop-2); z-index: 10; background-color: #E6ECF0; } .FixedTitleColumn { position: relative; left: expression(this.parentElement.offsetParent.scrollLeft-2); } .FixedDataColumn { position: relative; left: expression(this.parentElement.offsetParent.parentElement.scrollLeft-2); background-color: #E6ECF0; }</style></HEAD><BODY><div style="width:800px;height:560px;overflow:scroll;"><Table border=1><tr class="FixedTitleRow"><th class="FixedTitleColumn">xxxx1</th><th class="FixedTitleColumn">xxxx2</th><th class="FixedTitleColumn">xxxx3</th><%For x = 4 to xcnt%><th class="">th<%=x%></th><%Next%></tr><%For y = 1 to ycnt%><tr><td class="FixedDataColumn">xxxxyyyy</td><td class="FixedDataColumn">xxxxyyyy</td><td class="FixedDataColumn">xxxxyyyy</td><%For x = 4 to xcnt%><td>td<%=x%>,<%=y%></td><%Next%></tr><%Next%></table></div></BODY></HTML>
相同的方式,應該也可以用在GridView裡面
參考網址:http://www.chenjiliang.com/Article/View.aspx?ArticleID=1876&TypeID=30