Wednesday, March 21, 2012

Use Animation Control with hidden TargetControlID

Hi all,

I use the Animation Control and it works fine. But sometimes I want to hide the target control (an imagebutton) because the animation should not be available. But when I hide the image I always get an error message

Microsoft JScript runtime error: Sys.ArgumentException: AjaxControlToolkit.Animation.Animation.set_animationTarget requires the ID of a Sys.UI.DomElement or Sys.UI.Control. No element or control could be found corresponding to "ctl00_PlaceHolderMain_ShowAnimation"
Parameter name: id

"ShowAnimation" is the Target Control used in my "OpenAnimation" Extender. My current workaround is to replace the icon with a blank gif so it is not visible to the user, but is there a better way to do it? Like disabling an extender under a certain condition? Many thanks in advance!

Hi,

Are you hiding the element by setting Visible="false"? If so, this will prevent the element from being rendered on the page (and hence there will be no ID for the animation to target). Instead you should just set style="display: none;" or use the <HideAction Visible="false" /> animation.

Thanks,
Ted

No comments:

Post a Comment