uid | title | author | description | ms.author | ms.date | ms.assetid | msc.legacyurl | msc.type |
---|---|---|---|---|---|---|---|---|
web-forms/overview/ajax-control-toolkit/animation/dynamically-controlling-updatepanel-animations-vb |
Dynamically Controlling UpdatePanel Animations (VB) | Microsoft Docs |
wenz |
The Animation control in the ASP.NET AJAX Control Toolkit is not just a control but a whole framework to add animations to a control. For the contents of an... (VB) |
riande |
06/02/2008 |
bea66072-59b6-42b4-98fa-211812f5925f |
/web-forms/overview/ajax-control-toolkit/animation/dynamically-controlling-updatepanel-animations-vb |
authoredcontent |
The Animation control in the ASP.NET AJAX Control Toolkit is not just a control but a whole framework to add animations to a control. For the contents of an UpdatePanel, a special extender exists that relies heavily on the animation framework: UpdatePanelAnimation. It can also work together with UpdatePanel triggers.
The Animation control in the ASP.NET AJAX Control Toolkit is not just a control but a whole framework to add animations to a control. For the contents of an UpdatePanel
, a special extender exists that relies heavily on the animation framework: UpdatePanelAnimation
. It can also work together with UpdatePanel
triggers.
The first step is as usual to include the ScriptManager
in the page so that the ASP.NET AJAX library is loaded and the Control Toolkit can be used:
[!code-aspxMain]
The animation in this scenario will be applied to a display of the current time. This information can be written into a label using the Page_Load()
method, or (for the sake of simplicity) the following inline code is used:
[!code-aspxMain]
Also, a button to trigger updating the time is created:
[!code-aspxMain]
This code is then put into the <ContentTemplate>
section of an UpdatePanel
element. The panel's UpdateMode
attribute must be set to "Conditional"
, since only triggers may update the panel's contents. In the <Triggers>
section of the UpdatePanel
, an asynchronous postback trigger is created and tied to the Click
event of the button. Thus, if the user clicks on the button, the UpdatePanel
is refreshed. Here is the markup for the UpdatePanel
control:
[!code-aspxMain]
Finally, the UpdatePanelAnimationExtender
must be configured: Set the TargetControlID
attribute to the ID of the panel, and define an animation within the extender. Fading in makes sense, which creates a nice visual emphasis on the updated time. Your extender markup may then look like this:
[!code-aspxMain]
Run the file in the browser. Whenever you click on the button, the current time is shown in the panel, always fading in for the duration of one second.
The current time is fading in (Click to view full-size image)
[!div class="step-by-step"] Previous