ASP.NET AJAX UpdatePanel problem

Posted by Velika on Stack Overflow See other posts from Stack Overflow or by Velika
Published on 2010-03-30T18:46:37Z Indexed on 2010/03/30 19:13 UTC
Read the original article Hit count: 446

I'll try and be concise:

1) I have a dropdownlist with Autopostback set to TRUE
2) I have an UpdatePanel that contains a Label.
3) When the downdownlist selection is changed, I want to update the label.

Problem: Focus is lost on the dropdownlist, forcing the user to click on the dropdownlist to reset focus back to the control.

My "solution": In the DropDownList_SelectionChanged event, set focus back to the drop down list:

dropdownlist1.focus()

Problem:

While this works great in IE, Firefox and Chrome change the scroll position such that the control which was assigned focus is positioned at the bottom on the visible portion of the browser window. This is often a very disorientating side effect.

How can this be avoided so it works in FF as it does in IE?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about AJAX