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;
本文介绍如何在ASP.NET中设置页面属性以使网页在回发后自动返回到上次滚动的位置。提供了三种设置方法:应用级别配置、页面级别配置及编程方式设定。
2781

被折叠的 条评论
为什么被折叠?



