你知道吗...页面回传后如何保持滚动条的位置?

原文:http://blogs.msdn.com/webdevelopertips/archive/2009/06/08/tip-75-did-you-know-how-to-maintain-scrollposition-after-post-back.aspx

声音,本人英文是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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值