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 787819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:15:59+00:00 2026-05-14T21:15:59+00:00

I have a jquery accordion on an asp.net aspx weppage. Inside the panes, I

  • 0

I have a jquery accordion on an asp.net aspx weppage. Inside the panes, I have asp.net buttons. When I click on the button, the pane I was in, closes and reloads the page, defaulting to the first pane. I don’t mind the reload, but is there a way to keep the current pane open after the reload. Right now, I am just calling accordion() on a div with the id of accordion.

  • 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-14T21:15:59+00:00Added an answer on May 14, 2026 at 9:15 pm

    You could use a hidden input field to persist the active accordion index during postbacks, and then populate it using javascript during the change event of the accordion.

    <asp:HiddenField ID="hidAccordionIndex" runat="server" Value="0" />
    
    <script language="javascript" type="text/javascript">
        $(function(){
            var activeIndex = parseInt($('#<%=hidAccordionIndex.ClientID %>').val());
    
            $("#accordion").accordion({
                autoHeight:false,
                event:"mousedown",
                active:activeIndex,
                change:function(event, ui)
                {
                    var index = $(this).children('h3').index(ui.newHeader);
                    $('#<%=hidAccordionIndex.ClientID %>').val(index);
                }
            });
        });
    </script>
    

    You could probably come up with a more efficient way of capturing the active index during the change event, but this seems to work.

    When the page has loaded it retrieves the active index from the hidden field and stores it in a variable. It then initialises the accordion using the retrieved index and a custom function to fire on the change event which writes a new index to the hidden field whenever a new pane is activated.

    During a postback, the hidden field value is persisted in the ViewState so that when the page is loaded again the accordion is initialised with the index of the last pane clicked on.

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

Sidebar

Related Questions

I have a Jquery Accordion and I have a asp.net GridView below that. When
I have a simple JQuery enabled ASP.NET page: <script> $(document).ready(function() { $(#accordion).accordion(); }); </script>
I have a jQuery accordion in a page in ASP:Net MVC application in which
I have an ASP.NET MVC 3.0 application. Inside the application, I have a Login
Here is my setup: I have an asp.net button on a page -- <asp:Button
I have a jquery accordion style menu that I'd like to add some shortcut
I have a jquery accordion that I want to use nth-child to assign odd
So basically, I have a jQuery accordion. I arranged the content so that it
I have a jQuery based accordion style navigation that I am trying to modify.
I have the following structure for my jQuery Accordion: <ul id='accordion'> <li class='header'> <a

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.