共用方式為


UpdateProgress control in ASP.Net AJAX

Partial rendering in ASP.Net via async post-backs is one of the *MOST* loved and used feature in the ASP.Net AJAX stack. The UpdateProgress control adds value to the partial rendering scenarios by providing the user visual indication of any on-going async post-backs. A simple usage of the UpdateProgress control would look like the following

...

<asp:ScriptManager runat="server" id="Manager1" />

 <asp:UpdatePanel runat="server" id="Panel1">
   <contentTemplate>...</ContentTemplate>
 </asp:UpdatePanel>
 <asp:UpdateProgress runat="server" id="Progress1" DisplayAfter="0">
   <ProgressTemplate>
     <div style="font-weight:bold;">Working on request...</div>
   </ProgressTemplate>
 </UpdateProgress>
 ...

 This causes the UpdateProgress to display when an async post-back is in progress, the ProgressTemplate is used to define the content for the UpdateProgress control, if a ProgressTemplate is not defined then a runtime error occurs.The control is fully supported in Visual Studio and allows template editing via designer editable regions and thus the user doesn't need to explicitly enter template editing mode but can drop controls into the UpdateProgress directly in the designer. Any number of UpdateProgress controls are allowed on an aspx page.

The 'DisplayAfter' property on the control designates how long after the async post-back started does the Progress control needs to show up, the default value is 500 [in milli secs], this implies that the control will only be shown if the async post-back takes longer than 1/2 a sec.

The 'AssociatedUpdatePanelID' property is used to associate an UpdateProgress control with an UpdatePanel. The association causes the UpdateProgress control to show up only if the async post-back was raised by a control which is a child of the associated UpdatePanel. In the RTM release of ASP.Net AJAX extensions we are looking to expand this to also cover the controls defined as AsyncPostBackTrigger controls to the UpdatePanel. Currently in Beta2 though this would only work for immediate child controls of the UpdatePanel itself.

 I would love to hear your feedback and comments on this control.

 Thanks,

Kashif

Comments

  • Anonymous
    November 22, 2006
    > In the RTM release of ASP.Net AJAX extensions we are looking to expand this to also cover the controls defined as AsyncPostBackTrigger controls to the UpdatePanel. I definitely need this behavior. Currently I cannot use AssociatedUpdatePanelID because this is missing.

  • Anonymous
    November 22, 2006
    Also, UpdateProgress needs a RenderMode property because currently it renders as "block" while it would be really useful to have it displayed "inline" in most cases, next to the button that triggers an update for example.

  • Anonymous
    December 05, 2007
    Hi Kashif, Is it possible to display the updateprogress control only for asyncpostbacks of certain controls inside update panel? Can we restrict the showing up behaviour of update progress control only for asyncpostbacks of certain controls inside the associated update panel?