Can I not use the AnimationExtender inside of an UpdatePanel?
Basically I would like to add animations to a wizard I have inside an UpdatePanel. I tried adding AnimationExtenders onto the WizardSteps but they didn't do anything.
Am I just doing it wrong, or do I need to use an UpdatePanelAnimationExtender with a lot of conditions to decide what to do on each step?
You can target a control inside an UpdatePanel from an AnimationExtender that's outside the panel. You can also give a specific control target for each action, using the AnimationTarget property.
Sounds great, however, there is a bigger problem. It appears that an AnimationExtender outside of a wizard cannot have its TargetControlID be set to a control inside of a Wizard (regardless of being in an UpdatePanel). I just get this:
The TargetControlID of 'AnimationExtender1' is not valid. A control with ID 'Button1' could not be found.
This should work, normally you can reference controls within a wizard. Is this a bug?
Do a view source on that page in your browser, find the button, and use the ID it has there. It won't be Button1, but probably something like Wizard1_something_Button1.
Or, you can probably do that programmatically, by setting the AnimationExtender1.TargetControlID to Button1.ClientID in Page_Load.
Allow me to clarify. I'm talking about this TargetControlID:
<cc1:AnimationExtender ID="AnimationExtender1" runat="server"TargetControlID="Button1">
<Animations>
<OnClick>
<Color AnimationTarget="asdf" propertyKey="backgroundColor" startValue="#FFFFFF" endValue="#000000"/>
</OnClick>
</Animations>
</cc1:AnimationExtender>
As it turns out the AnimationExtender cannot reference a TargetControlID that is inside of a wizard. This does work if the AnimationExtender and the TargetControl are inside of the same wizardstep. The UpdatePanel wasn't really my problem, it was this.
Declare the AnimationExtender with no TargetControlID in your .aspx. Then, in your Page_Load method, add AnimationExtender1.TargetControlID = Button1.UniqueID.
What happens is that your Button1 is becoming Wizard1_Button1 in the DOM of the page, so when the AnimationExtender tries to reference it with $get('Button1'), it can't find it. For whatever reason, setting it to Wizard1_Button declaratively doesn't work either. Setting it programmatically does work.
Very interesting, I'm sure I'll be using that trick.
BTW, I should also note that, after testing this further, AnimationExtenders do work inside of Wizard that is inside of an UpdatePanel, my real problem was the other issue all along. Maybe this will have unexpected consequences, but its working for now.
No comments:
Post a Comment