AnimationExtender and MasterPage

Last post 02-21-2007 3:48 PM by fivestarMike. 4 replies.

Sort Posts:

  • AnimationExtender and MasterPage

    02-20-2007, 11:55 AM
    • Member
      7 point Member
    • fivestarMike
    • Member since 02-19-2007, 8:18 AM
    • Posts 7

    I seem to be having some trouble getting AJAX to work with MasterPages.

    I created a new website using the AJAXControlToolkit template then created a simple default.aspx page.

    It has a scriptmanager, panel, linkbutton, and an AnimationExtender.

    it is set to FadeIn the contents of the Panel when the LinkButton is Hovered and FadeOut the contents when

    moving off the LinkButton.  This page works as expected.

    Then I create a master page and add nothing to it.

    Then I created a new WebForm using the master page.  In the ContentPlaceHolder, I place the same markup as the default page.

    When this page is run it has a Javascript 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 'Panel1'

    Parameter name: id

     I am at a loss as to what could be causing this.  Any help would be appreciated.

     

    Mike

  • Re: AnimationExtender and MasterPage

    02-20-2007, 8:53 PM
    • Contributor
      2,148 point Contributor
    • Phanatic
    • Member since 10-07-2005, 3:48 AM
    • Redmond , WA
    • Posts 396

    Hi,

    Once the page is rendered , can you look at the source in IE to understand if a control by the ID of "PANEL1" exists?

     MasterPages  mangle ControlIDs.

     

     

    Phani Raj
    http://blogs.msdn.com/PhaniRaj
  • Re: AnimationExtender and MasterPage

    02-21-2007, 7:32 AM
    • Member
      7 point Member
    • fivestarMike
    • Member since 02-19-2007, 8:18 AM
    • Posts 7

    Thanks for the reply!

     

    It appears to be the name mangling that is the problem.  If I change the reference to Panel1 to ctl00_ContentPlaceHolder1_Panel1

    it works as it should.  So.....how do I make that change to the AnimationTarget Property at runtime? 

    I would like to avoid hard coding the ID in case the Master Page changes.

     

    Thanks.

     

     

  • Re: AnimationExtender and MasterPage

    02-21-2007, 8:29 AM
    • Contributor
      2,148 point Contributor
    • Phanatic
    • Member since 10-07-2005, 3:48 AM
    • Redmond , WA
    • Posts 396

    1) assign a BehaviourID to your AnimationExtender , assume AnimationExtenderBehaviour1.

    2) Use the "set_animationTarget" method of the Behaviour to change the Target Element of the Animation

    3) Try the Following JavaScript

    <

    script language="javascript">

     

    function ChangeAnimationTarget(){

     

    var animator = $find("AnimationExtenderBehaviour1");

    ///ID of a Sys.UI.DomElement or Sys.UI.Control to use as the target of the animation

    animator.set_animationTarget(<ID>);

    }

     

     

    </script>

    Lemme know if this resolves the issue , if it does dont forget to mark it as an answer

    Phani Raj
    http://blogs.msdn.com/PhaniRaj
  • Re: AnimationExtender and MasterPage

    02-21-2007, 3:48 PM
    • Member
      7 point Member
    • fivestarMike
    • Member since 02-19-2007, 8:18 AM
    • Posts 7

    I suppose I am not really sure how to implement this as suggested.  I've never used BehaviorID before so I'm not following exactly what

    this is supposed to be doing.

    Does this Javascript function need to be in the masterpage? 

    Should the reference to AnimationTarget in the <ajaxToolkit:AnimationExtender> tag be removed completely?

    The page shows a JS error if the reference is left in, even if it is set to "". 

    Can the Panel1 ID be assigned using <%# Eval(FindControl("Panel1")) %> or something similar?

     

    Thanks for your help.

     

    Mike

Page 1 of 1 (5 items)