Wednesday 4 April 2012

Simple Animation Example

  Creating Animation in Asp.net Ajax.

Here is the simple Example of Animation used in the asp.net. Here i used the Animation Extender to fade in and fade out of the content in a certain duration. To use the Ajax control in asp.net application first u need to add the ScriptManager.

To implement this concept you need to follow the below steps

Step1:
Create a new Asp.net website in Visual Studio and write the following html code in the design part of the Default.aspx page.

Design code :
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:LinkButton ID="lnkbtn" OnClientClick="return false;" runat="server">Start Animation</asp:LinkButton>
        <br />
        <asp:Panel ID="Message" runat="server" Width="250px">
     <h2 style="color:#FFF;">SRIDHAR...!</h2>
    </asp:Panel>
        <br />
     <asp:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="lnkbtn">
        <Animations>
        <OnClick>
        <Sequence>
        <Color 
          AnimationTarget="Message" 
          Duration="3" 
          Property="style" 
          PropertyKey="backgroundColor"
          StartValue="#CE0E3F" 
          EndValue="#FFFFFF" /> 
         </Sequence>
         </OnClick>
        </Animations>
        </asp:AnimationExtender>
    </div>
    </form>
</body>
</html>


Step2:
Now build the Solution and Debug it for the output.

Output Page :

No comments:

Post a Comment