Provides visual feedback in the browser when the contents of one or more UpdatePanel controls are updated.
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)] [AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)] public ref class UpdateProgress : public Control, IScriptControl
The control enables you to provide feedback about the progress of partial-page rendering. For postbacks or initial page rendering, control content is not displayed.
The page can contain multiple controls. Each one can be associated with a different UpdatePanel control. Alternatively, you can use one control and associate it with all the UpdatePanel controls on the page.
The control renders a div element that is displayed or hidden depending on where a postback originates and whether the AssociatedUpdatePanelID property of the control is set.
Associating an UpdateProgress with an UpdatePanel Control
You associate controls with an UpdatePanel control by setting the AssociatedUpdatePanelID property of the control. When a postback event originates from inside an UpdatePanel control, any associated controls are displayed. If you do not set the AssociatedUpdatePanelID property, the control displays progress for any asynchronous postback that originates from inside any UpdatePanel control. It is also displayed for any controls that are triggers for panels.
The AssociatedUpdatePanelID property has the following effect on control behavior:
When the AssociatedUpdatePanelID property is not set, the control is displayed for the following postbacks:
If the AssociatedUpdatePanelID property is set to a control that does not exist, the control will never be shown.
Specifying the Content of the UpdateProgress Control
The template can contain HTML and markup. For example, you can display an animated image that notifies the user that the postback is processing. You can also display a button that the user can click to stop the partial-page update. Additionally, you might want to prevent all other postbacks while one is in progress. The following example shows client script that you can use to accomplish these tasks.
You can use the example code by setting the onClick attribute of an HtmlButton control to "AbortPostBack()". For more information, see the abortPostBack method and the isInAsyncPostBack property of the PageRequestManager class.
Putting UpdateProgress Controls on the Page
controls can be inside or outside other UpdatePanel controls. The display of the control's template does not depend on where the control is located. In a nested UpdatePanel control, a child panel is inside a parent panel. In that case, a postback that originates from inside the child panel causes all controls associated with the child panel and the parent panel to be displayed. If a postback originates from an immediate child control of the parent panel, only the controls that are associated with the parent panel are displayed.
Customizing When UpdateProgress Controls Are Displayed
By default, the control waits .5 seconds (500 milliseconds) before it displays its contents. This helps prevent the control from flashing if an asynchronous postback is very quick. You can specify the delay by setting the DisplayAfter property.
If you need finer control over when an control is displayed, you can provide client script for the beginRequest and endRequest events of the PageRequestManager class. In the beginRequest event handler, you can display the DOM element that represents the control. In the endRequest event handler, you can hide it.
You must provide client script to display an control when a target UpdatePanel control is updated in the following circumstances:
When a postback from a control is registered as an asynchronous postback trigger for the panel, and there is an control on the page. However, the AssociatedUpdatePanelID property is not set to the panel's ID.
The following examples show different ways to use the control to show progress during asynchronous postbacks.
The following example shows one control that displays progress status for two UpdatePanel controls.
This following example shows two controls. Each control displays progress status for an associated UpdatePanel control.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.