【IT168技术文档】
前台
后台代码<script> function scrool() { var t = document.getElementById("<%=gvCheckList.ClientID%>"); var t2 = t.cloneNode(true) for(i = t2.rows.length -1;i > 0;i--) t2.deleteRow(i) t.deleteRow(0) head1.appendChild(t2) } window.onload = scrool </script> <div id="head1"></div> <div style="height:186px;width:100%;overflow-y: scroll;"> <asp:GridView ID="GridView1" runat="server" Width="97%" > <RowStyle Height="26px" /> <HeaderStyle BackColor="#EDEDED" Height="26px" /> </asp:GridView> </div>
Page_Load
this.GridView1.Attributes.Add("style", "table-layout:fixed");