如何使用母版页保持滚动位置? [英] How to persist scroll position using Master Page?

查看:80
本文介绍了如何使用母版页保持滚动位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用母版页的网站,唯一更改的内容是页面中心的Div.

I have a site that uses master pages, the only content that changes is a Div in the centre of the page.

是否可以在回发之间保留页面的滚动位置?我认为这可能是可能的,因为所有页面都使用相同的母版页,如果没有的话,还有其他方法可以这样做吗?

Is there a way that I can persist the scroll position of the page between postbacks? I'm thinking that it might be possible because all pages are using the same Master Page, if not is there some other way to do this?

谢谢

推荐答案

尝试添加this.Page.MaintainScrollPositionOnPostBack = true;母版页代码后面的某个位置(例如页面加载)

Try adding this.Page.MaintainScrollPositionOnPostBack = true; somewhere in the masterpage code behind (for example page load)

这篇关于如何使用母版页保持滚动位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆