How to catch AccordionPane Select Event ?

Last post 01-24-2008 5:36 AM by tequilatime@gmail.com. 20 replies.

Sort Posts:

  • How to catch AccordionPane Select Event ?

    09-21-2006, 7:40 PM
    • Loading...
    • prakis
    • Joined on 07-12-2006, 5:52 PM
    • Bangalore
    • Posts 7

    Hi there, 

    I need to change the content of a Panel whenever user clicks on one of the AccordionPane Header.

    Are there any events fired whenever one of the AccordinPane Expands or Collapse ? 

     ----In more detailed

     I have Accordin Control on the left of the screen with 3 elements (School, Collage, University), On the right I have a big Details Panel(Yellow one). The content of the this DetailsPanel should change based on which AccordinPane is currently Expanded.Accordin

     
    Thankyou,

    Kishore. 

  • Re: How to catch AccordionPane Select Event ?

    09-26-2006, 2:09 PM
    Hi Kishore,

    Yes, you can do this from JavaScript.  You should listen for the propertyChanged event to be raised on the AccordionBehavior and check if the property is selectedIndex (you can see where we raise it in AccordionBehavior.set_selectedIndex).  There's no event that is raised server side, but you could also tell when this happens by caching the selected index and comparing it every postback to determine when it was changed.

    Thanks,
    Ted
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Filed under:
  • Re: How to catch AccordionPane Select Event ?

    10-04-2006, 10:48 AM
    • Loading...
    • mc24
    • Joined on 09-21-2006, 6:34 AM
    • Posts 8

    Hi Ted !

    I couldn't catch it using AccordionBehavior and selectedIndex but with the following it work's

    function accSelectedChange(sender, eventArgs) {

    if (eventArgs.get_propertyName() == "SelectedIndex")

    {

    alert(sender.get_ClientState());

    }

    }

     

    function pageLoad() {

    $object('accObjekt_AccordionProperties').propertyChanged.add(accSelectedChange);

    }

    - am I missing something or has the names changed ?

      

     

    Filed under: ,
  • Re: How to catch AccordionPane Select Event ?

    10-05-2006, 9:46 PM
    Hi mc24,

    No - we're talking about the same thing.  accObjekt_AccordionProperties is an instance of the AccordionBehavior, whose propertyChanged event you're listening to.

    Thanks,
    Ted
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: How to catch AccordionPane Select Event ?

    10-06-2006, 10:11 AM
    • Loading...
    • prakis
    • Joined on 07-12-2006, 5:52 PM
    • Bangalore
    • Posts 7

    Thankyou Ted and mc24,

     

  • Re: How to catch AccordionPane Select Event ?

    10-27-2006, 9:54 PM
    • Loading...
    • John Grieb
    • Joined on 09-21-2005, 11:05 PM
    • New York
    • Posts 25

    I'm trying to use the following code to set the propertyChanged event handler in the Ajax Control Toolkit sample and it isn't working.

    Sys.Application.add_init(function() {
          
    var behavior = $find("ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender");
           if (behavior)
           {
               
    behavior.propertyChanged.add(processSelectionChanged);
           }
       });

     Can someone please tell me what I'm doing wrong?

     Thanx,

    John P. Grieb

  • Re: How to catch AccordionPane Select Event ?

    10-28-2006, 8:43 PM
    • Loading...
    • John Grieb
    • Joined on 09-21-2005, 11:05 PM
    • New York
    • Posts 25

    Figured it out.

    Instead of:

                 behavior.propertyChanged.add()

    You need to use:

                 behavior.add_propertyChanged()

     John

  • Re: How to catch AccordionPane Select Event ?

    11-30-2006, 6:01 PM
    • Loading...
    • brendalisa
    • Joined on 11-29-2006, 4:02 PM
    • Posts 40

    If you don't want to do it in Javascript, I can show you how in C#.  Just let me know.

     Brenda

    Brenda
  • Re: How to catch AccordionPane Select Event ?

    11-30-2006, 10:59 PM
    • Loading...
    • noobsaibot
    • Joined on 10-27-2006, 11:50 PM
    • Posts 1
    brendalisa:

    If you don't want to do it in Javascript, I can show you how in C#.  Just let me know.

     Brenda

    I would like to see how that works :) If you don't mind.

  • Re: How to catch AccordionPane Select Event ?

    01-23-2007, 10:19 AM
    • Loading...
    • mthomlins
    • Joined on 12-11-2006, 3:43 PM
    • Cambridge Ontario Canada
    • Posts 76
    John Grieb:

    $find("ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender");
     

     Im trying to accomplish something similar but with a CollapsiblePanelExtender. Named MyCollapsiblePanelExtender.

    Im confused at the makup of the quoted line. is ctl00 the ID of the control? is AccordionExtender the control type?

     a little more detail into how you created the line ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender would be helpful.

  • Re: How to catch AccordionPane Select Event ?

    01-23-2007, 3:47 PM
    • Loading...
    • mthomlins
    • Joined on 12-11-2006, 3:43 PM
    • Cambridge Ontario Canada
    • Posts 76
    mthomlins:
    John Grieb:

    $find("ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender");
     

     Im trying to accomplish something similar but with a CollapsiblePanelExtender. Named MyCollapsiblePanelExtender.

    Im confused at the makup of the quoted line. is ctl00 the ID of the control? is AccordionExtender the control type?

     a little more detail into how you created the line ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender would be helpful.

     

    Answer to my own question.

    ctl00_ is added to various Components at Run-Time... During your testing phase run your page and view the source, within the source you will notice the addition of the ctl00_ if you are using a master page. If you are not using a master page i would gather that this is not added.

  • Re: How to catch AccordionPane Select Event ?

    01-23-2007, 3:59 PM
    • Loading...
    • mthomlins
    • Joined on 12-11-2006, 3:43 PM
    • Cambridge Ontario Canada
    • Posts 76

    The Code posted above is out of date.... Try this instead (Mine is on a CollapsiblePanelExtender)

     

    function

    pageLoad() {

    var Temp1 = $find('ctl00_CollapsiblePanelExtender');

    Temp1.add_propertyChanged(cpCollapsed);

     

    alert(Temp1.get_id());

    }

    function

    cpCollapsed(sender, eventArgs)

    {

    if (eventArgs.get_propertyName() == "Collapsed")

    {

    alert(

    "Hi");

    }

    }

  • Re: How to catch AccordionPane Select Event ?

    02-12-2007, 6:11 PM
    • Loading...
    • sddavidm
    • Joined on 02-27-2003, 6:21 PM
    • Posts 41

    I am trying to setup the event like this:

    function pageLoad() {
    document.getElementById('<%= MyAccordion.ClientID %>').add_propertyChanged(accSelectedChange);
    }

    But I get the following errror:

    Object Doesn't Support This Property Or Method

     Any ideas why? 

     

    David McCarter
    Microsoft MVP
    dotNetTips.com
    http://www.codeplex.com/dotNetTipsUtility
    Filed under:
  • Re: How to catch AccordionPane Select Event ?

    02-15-2007, 6:21 PM

    I've been trying for 2 days to find a way to get this to work. I sure hope someone can help us.

    Thanks ... Ed

     

  • Re: How to catch AccordionPane Select Event ?

    04-06-2007, 4:20 PM
    • Loading...
    • sveksler
    • Joined on 08-03-2006, 6:06 PM
    • Posts 6

    Hi,

     

    The reason that it doesn't work is because the Accordion control is actually a wrapper for the AccordionExtender, so the ClientID of the element is not the same thing as the ClientID of the behavior. Unfortunately, the ClientID of the underlying Extender is not exposed through the Accordion class, but you can obtain its value by appending _AccordionExtender to the ClientID like so:

    ClientScript.RegisterArrayDeclaration("arrAccordionBehaviors", "'" + this.accControl.ClientID + "_AccordionExtender'");

    Now you can reference the behaviors array like so:

    for (var j = 0; j < arrAccordionBehaviors.length; j++)      {

    var bh = $find(arrAccordionBehaviors[j]);

    if (!bh)  continue;

    try   {

    bh.add_propertyChanged(accordionChange);

    } catch (e) {

    alert(e.message)

    };

    }

    Hope that helps!

    -Sabrina V 

     

    Sabrina Veksler
    Senior Developer
    Oxygen Media, NBC Universal
Page 1 of 2 (21 items) 1 2 Next >