How to persist scroll position using Master Page?

2019-05-01 03:48发布

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?

Thanks

3条回答
你好瞎i
3楼-- · 2019-05-01 04:29

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

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-05-01 04:29

4guysfromrolla.com has an article where a custom server control is created to maintain scroll position across postbacks. Maybe it could be of some use to you.

查看更多
登录 后发表回答