看着我,看着我的眼睛!    RichardZhang Blog

也许永远实在太远!也许人生真的无法十全十美!
There are many unimaginable things happened in our life, treat them peaceful.
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

ASP.Net SmartNavigation & MaintainScrollPositionOnPostBack

Posted on 2006-08-29 16:18  RichardZhang  阅读(623)  评论(0)    收藏  举报

大家是不是遇到过这种情况:
页面很长,当拖动到页面底部进行编辑的时候,控件选项改变,postback之后,页面总是又回到了top, 又得拖到后面才能操作.
一句话, “很烦”
下面有了解决办法,很简单,在页面的@Page中加一个属性SmartNavigation=”true”, 也可在BehindCode中写 Me.SmartNavigation=true
哈哈,一切烦恼都没了!

<%@ Page Language="VB" MasterPageFile="~/FinanceManagement/FinanceMaster.master"
    AutoEventWireup="false" CodeFile="Organization.aspx.vb" Inherits="FinanceManagement_Organization"
    Title="SP China 网上费用报销" SmartNavigation="true" %>


上面的是framework1.1中的用法
在framework2.0中推荐使用属性MaintainScrollPositionOnPostBack

但是MaintainScrollPositionOnPostBack没有SmartNavigation效果棒,
又但是IE7对SmartNavigation的支持非常不好,导致CSS不能正常生效, SmartNavigation在IE6中效果特棒.
所以只能委屈一下使用MaintainScrollPositionOnPostBack