前台
<script type="text/javascript">
//刷新时滚动条保留位置
function ScrollToSelectNode() {
document.getElementById("left").scrollTop = "<%=ScrollValue%>";
}
function bindData() {
document.getElementById("divScrollValue").value = document.getElementById("left").scrollTop;
}
</script>
<input runat="server" id="divScrollValue" type="hidden" value="" />
<div id="left" style="width: 90%; height: 300px; margin-left: 30px; overflow: auto; text-align: center;">
<asp:GridView ID="gvData" runat="server" CssClass="mGrid" AutoGenerateColumns="false"
AllowPaging="false" PageSize="10" OnRowDataBound="gvData_RowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkSel" runat='server' Checked="false" Enabled="true" />
</ItemTemplate>
<HeaderStyle Wrap="False" />
<ItemStyle Width="40px" Wrap="False" />
</asp:TemplateField>
<asp:BoundField DataField="LOT" HeaderText="<%$ Resources:GSEOFace, LOT %>" SortExpression="LOT">
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="Attribute_01" HeaderText="<%$ Resources:GSEOFace, BWPartNo %>"
SortExpression="Attribute_01">
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="Attribute_10" HeaderText="番号" SortExpression="Attribute_10">
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:BoundField DataField="BMoldCode" HeaderText="<%$ Resources:GSEOFace, UseNumNo %>"
SortExpression="BMoldCode">
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:TemplateField HeaderText="新AB板/下座" ItemStyle-Width="80px">
<ItemTemplate>
<asp:TextBox ID="txtNewLot" runat="server" Enabled="true" AutoPostBack="true" OnTextChanged="txtNewLot_TextChanged" onchange="bindData()"></asp:TextBox>
</ItemTemplate>
<ItemStyle Width="80px"></ItemStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
后台
public static string ScrollValue = string.Empty;//滚动条位置
ScrollValue = divScrollValue.Value;//加载时