简体   繁体   中英

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. 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.

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? If so, there's a Page.SetFocus(Control C) method that should be what you're looking for

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.

So it probably won't work with older versions of IE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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