声音,本人英文是26个字母的水平,如果错误,还请谅解。
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.
译:当页面在服务器回传后,默认情况是返回到页面的顶部。在一个大的页面,你可能需要自动滚动到用户最后定位的位置。
MaintainScrollPositionOnPostBack页面属性是可以用来实现这个目标的方法之一。
1. · 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.
译:1. 应用程序层:在网站整个页面设置这个属性的默认值,打开web.config 文件并在节:pages 添加这个属性
<pages maintainScrollPositionOnPostBack="true">
a) 译:1. 应用程序层:在网站整个页面设置这个属性的默认值,打开web.config 文件并在节:pages 添加这个属性
2. · Page Level: for a particular page, open the aspx and set the property
译:2. 页面层:在特定的页面,打开aspx 文件并设置属性
<%@ Page MaintainScrollPositionOnPostback="true" ...
3. · Code level: to set the property programmatically
译:2. 代码层:设置属性
Page.MaintainScrollPositionOnPostBack = true;
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/yyj135/archive/2009/06/17/4275854.aspx