Tip: Using the Toolkit's Animation framework without the AnimationExtender
The Ajax Control Toolkit provides a powerful framework for creating animations, which consists of a set of classes contained in the client AjaxControlToolkit.Animation namespace.
The Animations.js file, which contains the definitions of all the animation classes, is loaded at runtime by the AnimationExtender (or the UpdatePanelAnimationExtender) together with other script files from which it depends.
If we want to take advantage of the Toolkit's Animation framework even without relying on an Extender, we have to add the following script references through the ScriptManager control:
| <asp:ScriptManager id="TheScriptManager" runat=”server”> |
| <Scripts> |
| <asp:ScriptReference Assembly="AjaxControlToolkit" |
| Name="AjaxControlToolkit.Common.Common.js" /> |
| <asp:ScriptReference Assembly="AjaxControlToolkit" |
| Name="AjaxControlToolkit.Compat.Timer.Timer.js" /> |
| <asp:ScriptReference Assembly="AjaxControlToolkit" |
| Name="AjaxControlToolkit.Animation.Animations.js" /> |
| </Scripts> |
| </asp:ScriptManager> |
And if we're developing an Extender or a Script Control that makes use of the Animation framework, we can decorate the server class with the following RequiredScript attribute in order to have the Animations script file and all its dependencies automatically loaded at runtime:
| [RequiredScript(typeof(AnimationScripts)] |
The AnimationScripts type is contained in the AjaxControlToolkit namespace, inside the AjaxControlToolkit assembly.