UpdateProgress does not show up when AssociatedUpdatePanelID is set

I'm currently working on a little ASP.NET AJAX project and got stuck with what seems a bug on ASP.NET AJAX UpdateProgress control.

As I've searched through the net (thanks Google), apparently it's really a bug, as you can attest here.

For what I've seen a lot of people have encountered this bug, but no one has attempted to find the root of the problem... until now.

Well, I dug into the ASP.NET AJAX client scripts to find WTF was going on and why the damn control does not appear when it should (as far as the documentation, and expected behavior goes).

With no further ado, here is the code:<

function Sys$UI$_UpdateProgress$_handleBeginRequest(sender, arg)
{
  var curElem = arg.get_postBackElement();
  var showProgress = !this._associatedUpdatePanelId;
  while (!showProgress && curElem)
  {
    if (curElem.id &&
        this._associatedUpdatePanelId === curElem.id)
    {
      showProgress = true;
    }
    curElem = curElem.parentNode;
  }
  if (showProgress)
  {
    this._timerCookie =
       window.setTimeout(this._startDelegate,
                         this._displayAfter);
  }
}

OK, so what we have here?

This little function, which is a method of the UpdateProgress client DOM, is the responsible for showing the UpdateProgress control on the client during the asynchronous post back.

When this function is fired it gets the element firing the post back event, then it checks if it has an associated UpdatePanel, if it does not have and associated UpdatePanel it is shown immediately (i.e., after the amount of time specified in the DisplayAfter property).

The problem is when it HAS an UpdatePanel associated.

Unless the control firing the event is a child of the UpdatePanel, the UpdateProgress control will not be shown.

And THAT's the problem.

If the event is fired anywhere else outside the UpdatePanel, no luck.

Yes, I know that I could show the UpdateProgress by calling the async functions, but what the heck?

I didn't have enough time at the moment to goo deep enough to find how it could be fixed, but at least now we have a good explanation WHY the damn panel does not show.

Comments