Tip #75: Did you know…How to maintain scrollposition after post back?
When web pages are posted back to the server, by default user is returned to the top of the page. On a large web page, you might have a requirement to scroll down the user automatically to the last position on the page.
MaintainScrollPositionOnPostBack page property can be used to achieve this in one of the following ways.
- Application level: To set the property by default for all
pages in the website, open web.config and add the attribute to the pages
node.
<pages maintainScrollPositionOnPostBack="true">
- Page Level: for a particular page, open the aspx and set
the property
<%@ Page MaintainScrollPositionOnPostback="true" ...
- Code level: to set the property
programmatically
Page.MaintainScrollPositionOnPostBack = true;
Hope this helps.
Deepak Verma
邮箱:james@taogame.com
QQ:785418
微信:jamesying1
QQ群:376248054 通关:cnblogs
技术改变生活,技术改变人生!用技术来创造价值,拥有技术,不仅仅是开发,您将获得更多!如果您觉得我能帮到您,您可以通过扫描下面二维码来【捐助】我!
QQ:785418
微信:jamesying1
QQ群:376248054 通关:cnblogs
技术改变生活,技术改变人生!用技术来创造价值,拥有技术,不仅仅是开发,您将获得更多!如果您觉得我能帮到您,您可以通过扫描下面二维码来【捐助】我!