Search code examples
c#asp.netajaxcontroltoolkitformview

AjaxControlToolkit AnimationExtender - show animation on FormView Insert/Update


In my application, I have a FormView which allows Insert's and Update's. I want to show a message which dissappears after about 2-3 seconds whenever they insert or update. I figured the AnimationExtender from the AjaxControlToolkit would be the best way of doing this, but I can't figure out how to get that animation to fire when a FormView is updated/inserted. Any ideas?


Solution

  • Have you tried calling the animation in the ItemInserted or ItemUpdated events for the FormView? That sounds like it would do the trick for you. They fire every time an Update or Insert occurs from that control.

    Alternately, you could just set the TargetControlID of your AnimationExntender to the id of your Update / Insert button (the one's on your FormView with CommandName set to "Insert" or "Update"), then just specify your desired animation in the OnClick event:

    <ajaxToolkit:AnimationExtender ID="myAnimExtender"
      runat="server" TargetControlID="updateBtn">
        <Animations>
            <OnClick> ... </OnClick>
        </Animations>
    </ajaxToolkit:AnimationExtender>
    

    Note that this technique requires you to have two AnimationExtenders, one for the Delete button and one for the Update button.