views:

64

answers:

2

I have this:

<cc1:UpdatePanelAnimationExtender ID="UpdatePanelAnimationExtender1"
            TargetControlID="pnlUpdatePeriodDetails" runat="server">
            <Animations>
                <OnUpdating>
                   <Parallel duration="0">
                        <ScriptAction Script="onUpdating('divLoadingImage', 'divDetailsContent');" />
                        <EnableAction AnimationTarget="btnInvoke" Enabled="false" />                    
                    </Parallel>
                </OnUpdating>
                <OnUpdated>
                    <Parallel duration="0">
                        <ScriptAction Script="onUpdated('divLoadingImage', 'divDetailsContent');" /> 
                        <EnableAction AnimationTarget="btnInvoke" Enabled="true" />
                    </Parallel>
                </OnUpdated>
            </Animations>
     </cc1:UpdatePanelAnimationExtender>

I want to create this animation extender programatically... but I am having trouble. Is it possible? Is it easy?

+2  A: 

See http://msdn.microsoft.com/en-us/library/c0az2h86.aspx for details, but essentially you just have to call LoadControl with the path to your .ascx

Stuart Dunkeld
That's very interesting!Unfortunately I am trying to do it all programatically, ie. UpdatePanelAnimationExtender ae = new UpdatePanelAnimationExtender().....
SLC
+2  A: 

The extender's Animations property is a string that is parsed as XML, so you should be able to do this:

Controls.Add(
    new UpdatePanelAnimationExtender()
    {
        Animations = "<OnUpdating>...</OnUpdating><OnUpdated>...</OnUpdated>"
    }
);
dahlbyk