刷新时滚动条保留位置

前台
<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" οnchange="bindData()"></asp:TextBox>
                                                            </ItemTemplate>
                                                            <ItemStyle Width="80px"></ItemStyle>
                                                        </asp:TemplateField>
                                                    </Columns>
                                                </asp:GridView>
                                          </div> 
                                       
后台
public static string ScrollValue = string.Empty;//滚动条位置
       ScrollValue = divScrollValue.Value;//加载时

转载于:https://www.cnblogs.com/CSharpStudy/archive/2012/04/20/2459842.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值