Click here to Skip to main content
15,901,284 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to fade-in and fade-out a panel on click of a button. In the following code a click on the
panel helps the panel to fade away. How to use the button for both to happen.

XML
<asp:UpdatePanel ID="UpdatePanel133" runat="server" >
    <ContentTemplate>
    <asp:Panel ID="ss" runat="server"  style=" width:544px; height:333px; background-color:Red; margin-left:230px; top:312px">
    </asp:Panel>
<asp:Button ID="Animate" runat="server" OnClick="ClickToAnimate" Text="ClickToAnimate" BackColor="Green" style="
     margin-left:12px; height:24px" />
<asp:AnimationExtender id="MyExtender"
  runat="server" TargetControlID="ss">
  <Animations>
    <OnClick>
      <FadeOut Duration=".5" Fps="20" /><%-- FadeIn =".1" Fps="10"/>--%>
    </OnClick>
  </Animations>
</asp:AnimationExtender>
</ContentTemplate>
    </asp:UpdatePanel>


C#
protected void ClickToAnimate(object sender, EventArgs e)
  {

  }
Posted

1 solution

Have you thought about changing your animation extenders to jQuery ?
If so, the JavaScript would be as easy as this :
JavaScript
$('#<%=UpdatePanel133.ClientID %>').fadeIn();
$('#<%=UpdatePanel133.ClientID %>').fadeOut();
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900