1

Is there a way to have two or more open panes on an AJAX accordion control? The page will default to both panes open and user can close pane if desired.

3 Answers 3

3

According to the AJAX Control Toolkit description page:

The Accordion is a web control that allows you to provide multiple panes and display them one at a time

So, no is the answer to your question. You could use Collapsible Panels, which is what the Accordion control is made up of. You can have multiple instances of those visible at one time.

1

Use the repeater control.

Inside repeater, use accordion.

I want opposite functionality, found out this while fixing someone's code.

1

First, you need to use this script:

function ToggleAccordionPane(paneno) {

         $find('MyAccordion_AccordionExtender')._changeSelectedIndex(-1);
        if( $find('MyAccordion_AccordionExtender').get_Pane(paneno).content.style.display == "block") {
            $find('MyAccordion_AccordionExtender').get_Pane(paneno).content.style.display = "none";
            $find('MyAccordion_AccordionExtender')._changeSelectedIndex(paneno);
        }
        else {

         $find('MyAccordion_AccordionExtender').get_Pane(paneno).content.style.display = "block";
     }

     return false;
     }

Then, modify first header like this:

<Header><a href="" class="accordionLink" onclick="ToggleAccordionPane(0);">1. Accordion</a></Header>

For second and third pane:

<Header><a href="" class="accordionLink"  onclick="ToggleAccordionPane(1);">2. AutoSize</a></Header>

<Header><a href="" class="accordionLink" onclick="ToggleAccordionPane(2);" >3. Control or Extender</a></Header>

Source: http://www.c-sharpcorner.com/uploadfile/Zhenia/keeping-multiple-panes-open-in-accordion-web-control/

2
  • 1
    Done ... did as you advised me.
    – CyberHawk
    Jan 17, 2017 at 13:17
  • Good. Not my downvote btw, I lack domain knowledge to vote on this.
    – Baum mit Augen
    Jan 17, 2017 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.