http://expert.csdn.net/Expert/topic/2991/2991206.xml?temp=.9256098Keeping Scroll Position over post Backs:http://aspalliance.com/articleViewer.aspx?aId=356&pId=1http://dotnet.aspx.cc/ShowDetail.aspx?id=0C25068E-55EA-4124-8CD6-726ECF5D5D3Bhttp://expert.csdn.net/Expert/topic/2747/2747150.xml?temp=.1869013
<%@ Page SmartNavigation=ture %>
SmartNavigation=ture加上这个好象整个页面都变的乱七八糟的,原来引用的CSS文件都失效了,字体乱成一团,TABALE里面的组件也东一个西一个
//使用cookie ,js:<script id=clientEventHandlersJS language=javascript><!--
window.onload =function() {if(getcookie("height")!=null)document.body.scrollTop=getcookie("height");}
window.onunload =function () { setcookie("height",document.body.scrollTop);}function getcookie(sName){ var aCookie = document.cookie.split("; "); for (var i=0; i < aCookie.length; i++) { var aCrumb = aCookie[i].split("="); if (sName == aCrumb[0]) return unescape(aCrumb[1]); } return null;}
function setcookie(sName, sValue){ date = new Date(); date.setTime(date.getTime()+60000); //1 minute document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString();}
//--></script>
设置SmartNavigation=ture(页面或者config中)会有异常情况,以下方法可以解决该问题环境为VS.NET 2000和VS.NET 2003通过
<script language="javascript">function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null;}
function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); }function SetCookie (name, value) { document.cookie = name + "=" + escape (value) }</script>
在body中加入<body bgColor="#f1f5f5" leftMargin="0" topMargin="0" rightMargin="0" MS_POSITIONING="GridLayout" οnlοad="document.body.scrollTop=GetCookie('posy')" οnunlοad="SetCookie('posy',document.body.scrollTop)">