简体   繁体   English

回发后维护滚动位置(AJAX Control Toolkit可能存在问题)

[英]Maintaining scroll position after postback (possible problem with AJAX Control Toolkit)

I have some problems with maintaining scroll position after postback. 我在回发后保持滚动位置有一些问题。 First time I experienced the problem was when I (believe) added Combobox control from AJAX control Toolkit and/or UpdatePanel from AJAX Extensions. 我第一次遇到这个问题的时候,我(相信)从AJAX控件工具包和/或AJAX Extensions的UpdatePanel添加了Combobox控件。 The problem is when I do the postback on the page the page is loaded at the top and not where I did the postback. 问题是,当我在页面上进行回发时,页面加载在顶部,而不是我在回发的位置。

Actually, this wouldn't be a problem if it isn't happening on a very large form. 实际上,如果它不是以非常大的形式发生的话,这不会是一个问题。

I have already tried using MaintainScrollPositionOnPostback="true", but it wasn't helpful at all. 我已经尝试过使用MaintainScrollPositionOnPostback =“true”,但它根本没用。

I can provide the code if needed, but I don't think it would be of any use because I have comboboxes inside update panels which are rebinded on a button click. 如果需要,我可以提供代码,但我不认为它会有任何用处,因为我在更新面板中有组合框,在单击按钮时重新绑定。

Are you using asp.net 4? 你在使用asp.net 4吗? If so, there's a Page.SetFocus(Control C) method that should be what you're looking for 如果是这样,有一个Page.SetFocus(Control C)方法应该是您正在寻找的方法

http://msdn.microsoft.com/en-us/library/e04ah0f4.aspx http://msdn.microsoft.com/en-us/library/e04ah0f4.aspx

Note though, that according to the docs 但请注意,根据文档

The SetFocus method will work only on browsers supporting ECMAScript version 1.3 or later. SetFocus方法仅适用于支持ECMAScript 1.3或更高版本的浏览器。

So it probably won't work with older versions of IE 所以它可能不适用于旧版本的IE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM