Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Playing animation from code-behind

$
0
0

Here's my scenario, upon the completion a button click event I am trying to play an animation on a panel to alert user to the status text just updated. This is in an updatepanel, so the user can't tell if pressing add to cart is working so I thought a nifty animation to get their attention would do the trick.  

The animationextender var is always returning null no matter how I go about, whether I use the behaviorid or controlid or even control.ClientID the control is not found.  I suspect that lifecycle is playing a big role here but i'm not sure how to go about it differently. 

UPDATE: Tried condnesing code with the same outcome:

 ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "tmp""<script type='text/javascript'>$find('MessageFlasher').get_OnClickBehavior().get_animation().play();</script>"False)

Here is the jquery function that is failing,

function PlayAnimation() {
                var animationExtender = $find('MessageFlasher');  //BehaviorID of Extender
                if (animationExtender)
                {
                    animationExtender.get_OnClickBehavior().get_animation().play();
                }
            };

The PlayAnimation function is being called at the end of a button click method like this

 ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "tmp""<script type='text/javascript'>PlayAnimation();</script>"False)

Here is the TargetControl and extender;

                        <asp:Panel ID="pnl_popup" ClientIDMode="Static"  runat="server" >                            <asp:Label ID="lbl_Messagef" ViewStateMode="Disabled" Text="" runat="server"  />                        </asp:Panel>
<asp:AnimationExtender ID="AnimationExtender11" BehaviorID="MessageFlasher" runat="server" Enabled="True" TargetControlID="pnl_popup"><Animations><OnClick><Sequence><EnableAction Enabled="false" /><Color AnimationTarget="pnl_popup"
                            Duration="1"
                            StartValue="#FF0000"
                            EndValue="#666666"
                            Property="style"
                            PropertyKey="backgroundColor" /><Color AnimationTarget="pnl_popup"
                            Duration="1"
                            StartValue="#FF0000"
                            EndValue="#666666"
                            Property="style"
                            PropertyKey="backgroundColor" /><EnableAction Enabled="true" /> <fadeout duration=".8" FPS="30" /></Sequence></OnClick></Animations></asp:AnimationExtender>


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>