问题描述
我有gridView,记录可能很长.我有命令字段来更新记录.当我单击编辑"时,命令按钮将进行JavaScript回发.
Hi i have gridView and records can be long. I have command field to update records. When i click "Edit" the command button makes javascript postback.
javascript:__doPostBack('gridSubCategories$ctl02$ctl00','');
在回发页面没有滚动上一点之后,甚至我设置了MaintenanceScrollPositionOnPostback ="true".我该怎么办?
Even i set MaintainScrollPositionOnPostback="true", after postback page is not scrolling previous point. What can i do?
推荐答案
在回发页面没有滚动上一点之后,甚至我设置了MaintenanceScrollPositionOnPostback ="true".我该怎么办?
Even i set MaintainScrollPositionOnPostback="true", after postback page is not scrolling previous point. What can i do?
<script type="text/javascript" language="javascript">
window.onload = function () {
var strCook = document.cookie;
if (strCook.indexOf("!~") != 0) {
var intS = strCook.indexOf("!~");
var intE = strCook.indexOf("~!");
var strPos = strCook.substring(intS + 2, intE);
document.getElementById("ctl00_MainContentPlaceHolder_pnlFindings").scrollTop = strPos;
}
}
</script>
<script type="text/javascript" language="javascript">
function SetDivPosition() {
var intY = document.getElementById("ctl00_MainContentPlaceHolder_pnlFindings").scrollTop;
document.cookie = "yPos=!~" + intY + "~!";
}
</script>
在面板中,您需要:
onscroll ="SetDivPosition()"
那应该为你做.无论如何对我有用.
In the Panel, you''ll need:
onscroll="SetDivPosition()"
That should do it for you. Works for me, anyway.
这篇关于MaintenanceScrollPositionOnPostback不适用于javascript:__ doPostBack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!