Form loses focus after Ajax update

Last post 10-24-2008 2:51 PM by e_man_online. 2 replies.

Sort Posts:

  • Form loses focus after Ajax update

    10-06-2008, 10:41 AM
    • Member
      5 point Member
    • e_man_online
    • Member since 03-01-2004, 4:17 PM
    • Posts 7

    Hello,

    This problem is about a webpage in ASP .NET 2.0 (VB.NET) and AJAX. There's a conditional update panel around a dropdown, which populates the dropdown. When this update panel finishes the update, the focus goes to the 1st control on the page instead of staying on the control it was before the update. There's no explicit code in this page to change focus anywhere, so the focus should stay where it was before the AJAX update. Is this a bug in AJAX? Is there a solution for this? Your help will be greatly appreciated. Thank you.

    Sincerely,

     Richard

    Filed under:
  • Re: Form loses focus after Ajax update

    10-07-2008, 1:54 AM
    Answer
    • Member
      198 point Member
    • techieanuj
    • Member since 05-10-2007, 11:20 AM
    • India
    • Posts 52

    This article might be of some help: 

    http://www.codeproject.com/KB/ajax/PageRequestManager.aspx 

  • Re: Form loses focus after Ajax update

    10-24-2008, 2:51 PM
    • Member
      5 point Member
    • e_man_online
    • Member since 03-01-2004, 4:17 PM
    • Posts 7

    Thank you. I read the article--very interesting, but this issue is something that .NET/AJAX should take care of at the low level.

    (the following "subliminal" message is for MicroSoft) should be If the application programmer's code doesn't explicitly change the form's focus, the form's focus should be maintained by the framework just like the controls' state are.

    The problem with implementing the fix in that article is that if .NET/AJAX changes API, function names, etc, that code would break.

    So if an application programmer implements that code in several applications, that's going to be a problem.

    Also, there's no warantee that the suggested fix doesn't break or has a side effect on something else...

    (the following "subliminal" message is for MicroSoft) I insist, this is something that need to be fixed by the .NET/AJAX providers at that level, instead of by application programmers implementing workarounds individually.

    I do appreciate you pointing me to this article, and in case there are no other solution available, I might look into a fix like this one.

     Thank you very much,

     Richard

Page 1 of 1 (3 items)