Maintain Scroll Position on Postback in ASP.NET 2.0 (转)

This article shows how to allows pages to automatically maintain the current scroll position across postbacks.

The MaintainScrollPositionOnPostback page directive attribute allows to do that.

This feature is useful for large pages where scrolling is necessary to view input controls down further on the page.

There are three ways of applying the property to a web page.

  1. You can set it programmatically

    Page.MaintainScrollPositionOnPostBack = true;
  2. In the page declaration

    <%@ Page MaintainScrollPositionOnPostback="true" %>
  3. Or in the web.configs <system.web> section.

    <pages maintainScrollPositionOnPostBack="true" />
This feature is an absolute must-have on large web pages built for postback scenarios.

A simple but very useful feature.

Smartnavigation = true  implemented the same feature in 1.1 framework 

SmartNavigation only had "issues" and it only worked in IE but the new MaintainScrollPositionOnPostback apparently works in most common browsers. 

posted @ 2007-01-25 17:24 panzhilei 阅读(73) 评论(1)  编辑 收藏

  回复  引用    
#1楼 2008-07-26 12:05 | GC.molest [未注册用户]
我刚开始做网页,这个问题让我好烦恼。我在一个视频教程上看到过有个东西可以设置,但是忘记了,就记了个Position。看了你放在这里的东西,一下子就解决了,十分感谢。

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
"五向定位"职业成长路线公开课(上海、南京、大连)
Google站内搜索


相关链接: