Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 267933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:37:28+00:00 2026-05-11T23:37:28+00:00

The CollapsiblePanelExtender seems primarily designed to collapse/expand things in response to user mouse events.

  • 0

The CollapsiblePanelExtender seems primarily designed to collapse/expand things in response to user mouse events. Is there also a good way to get the extender to collapse/expand things in response to client-side javascript?

In my particular case, I have a number of CollapsiblePanelExtenders (and their corresponding Panels) on a page, and I’m wondering if I could implement an “expand all panels” button by doing something like this strictly on the client side:

for each CollapsiblePanelExtender on this page, call somethingOrOther(extender)

I can implement this logic server-side instead if I did a full postback, but my page takes a long time to load, and so this doesn’t seem like it would provide a very slick user experience. Thus I am interested in doing expand/collapse client-side.

It seems like this isn’t a use case the AJAX Control Toolkit people had in mind, but I thought I’d check.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T23:37:28+00:00Added an answer on May 11, 2026 at 11:37 pm

    I have a partly working solution now.

    I followed Ian’s suggestion and looked through the toolkit source. In CollapsiblePanelBehavior.debug.js, you can that expandPanel() is apparently intended as part of the public interface for the behavior. There’s also a get_Collapsed(). The key to accessing these behaviors in javascript seems to be setting the BehaviorID property on your CollapsiblePanelExtender tags in ASP.NET.

    I modified the repeater on my page so that the BehaviorIDs are predictible, along these lines:

    <ajaxToolkit:CollapsiblePanelExtender 
        BehaviorID="<%#'collapsebehavior'+DataBinder.Eval(Container.DataItem,'id')%>"
        ID="CollapsiblePanelExtender" runat="server" />
    

    This results with behaviors named collapsebehavior1, collapsebehavior2, collapsebehavior3, etc..

    With this done, I’m able to expand all the collapsible panels on the client as follows:

    function expandAll() {
        var i = 0;
        while (true) {
            i++;
            var name = 'collapsebehavior' + i;
            var theBehavior = $find(name);
            if (theBehavior) {
                var isCollapsed = theBehavior.get_Collapsed();
                if (isCollapsed) {
                    theBehavior.expandPanel();
                }             
            } else {
                // No more more panels to examine
                break;
            }
        }
    }
    

    I’m sure using $find in a loop like that is really inefficient, but that’s what I have so far.

    Also, it doesn’t work on Firefox for some reason. (On FF only the first element expands, and then there’s a Javascript error inside the Control Toolkit code.)

    This will all seem extremely ugly to all you javascript pros. Maybe I’ll clean things up later, or you can help me out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am encountering this error whenever the button is clicked to collapse/expand the panel.
Is there a way to have an AJAX CollapsiblePanel drop down and hover over
I have a CollapsiblePanelExtender that will not collapse. I have collapsed set to true
I have a a CollapsiblePanelExtender with the usual extend and collapse buttons....I would like
I have an asp.net ajax CollapsiblePanelExtender control on my page. The way this control
I am using ddaccordion for replacing Ajax CollapsiblePanelExtender. I want to achieve same behaviour
In a user control, I've got a Repeater inside of an UpdatePanel (which id
I have a ajaxToolkit:CollapsiblePanelExtender along with two asp:UpdatePanels it controls (one panel expands the
I'm using a CollapsiblePanelExtender with a checkbox. I would want to make the panel
I need to add a Javascript event for CollapsiblePanelExtender on Javascript pageload of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.