页面加载之间丢失滚动位置 [英] scroll position is lost between the page loads
本文介绍了页面加载之间丢失滚动位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为我的网站使用jquery标签。在选项卡中,我有一些用于更新数据的按钮。单击按钮时,页面将刷新。刷新页面后,转到顶部位置。我也想保持滚动位置。怎么做?
解决方案
在你的asp页面顶部的页面指令标签中添加MaintainScrollPositionOnPostback,如: -
<%@ Page 语言 = vb AutoEventWireup = false CodeBehind = testPage.aspx.vb
继承 = Abc.testPage MaintainScrollPositionOnPostback = true %>
我强烈建议您在页面中使用UpdatePanel控件。
< asp:ScriptManager runat = server > < / asp:ScriptManager >
< asp: UpdatePanel ID = updPnlStu runat = server >
< ContentTemplate >
将您的所有内容放在此处。
< / ContentTemplate >
< / asp:UpdatePanel >
我认为这对你有帮助。
: - )
Hi,
I am using jquery tabs for my website. In the tabs I have some buttons for update datas. When I click the button, the page is refreshed. After refreshing the page is go to top position. I want to keep the scroll position also. How to do it?
解决方案
Add MaintainScrollPositionOnPostback in page directive tags in top of your asp page like:-
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="testPage.aspx.vb" Inherits="Abc.testPage" MaintainScrollPositionOnPostback="true" %>
I would strongly recommend you to use UpdatePanel control in your page. <asp:ScriptManager runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="updPnlStu" runat="server"> <ContentTemplate> Put your all content here. </ContentTemplate> </asp:UpdatePanel>
I think this'll help you.
:-)
这篇关于页面加载之间丢失滚动位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文