Thursday, August 20, 2009

UpdateProgress is not working with AssociatedUpdatePanelID

Somebody found the UpdateProgress isn't working if it sets the property "AssociatedUpdatePanelID". Actually, when the Trigger control is outside UpdatePanel, and AssociatedUpdatePanelID of UpdateProgress is pointing to this UpdatePanel, the UpdateProgress won't be working.In the following sample, UpdateProgress AssociatedUpdatePanelID is pointing to UpdatePanel1, and Button1 which is the trigger control is outside UpdatePanel1. When you click the Button1, UpdateProgress will not be working.

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
Current Time <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

If Button1 is inside UpdatePanel1, the value of postBackSettings.PanelID will be generated to "UpdatePanel1Button1". AssociatedUpdatePanelID will be checked with postBackSettings.PanelID. If they are equel, UpdateProgress will be displayed.If Button1 is outside UpdatePanel1,the value of postBackSettings.PanelID will be generated to "ScriptManager1Button1". AssociatedUpdatePanelID is not matched with it, so it can't pop out UpdateProgress.In this case, we have to show UpdateProgress manually when the value of is button1.


Anonymous said...

Hello Vince:

I've just encourter the same problem, but in my case my trigger is a checkboxlist (which is outside of UpdatePanel), I am not sure how to do it manually? like what is the id for postBackElement? I tried cbl1 even cbl1_0 etc. doesn't work (cbl1 is the checkboxlist id) Thank you Appreciate your help. I will check back your blog for your answer. :) :)

Anonymous said...

OK, it's me again. I just figured out. I actually forgot to add "autopostback=true" to the checkboxlist, say me silly. After i've done that, the id will be cbl1_0, that worked.

Thank you so much for your blog. I have googled for almost an hour and you are the ONLY one has the right answer, at least point the user to the right direction.

Thank you :)

Vince Xu said...

I'm glad that it can help.

Unknown said...

I'm starting learning, could You say something more about how to do this: show UpdateProgress manually when the value of .

Wher I can find it?

Anonymous said...

I've just encourter the same problem and solution worked for me......

keep it up

Anonymous said...

I am so suprised that this actually worked for me, yes when the update progress is inside the panel and the trigger outside removing the AssociatedUpdatePanelID attribute works. Yippie!

Anonymous said...

Yes i try this trick to put update progress inside the update panel and it works accuratels. Thank you guys.