add ms ajax accordion pane at runtime loses previous pane issue

Posted by Chris Conway on Stack Overflow See other posts from Stack Overflow or by Chris Conway
Published on 2010-06-08T13:27:22Z Indexed on 2010/06/08 13:32 UTC
Read the original article Hit count: 421

I have an AjaxControlToolkit accordion control that i'm trying to load panes at runtime. When I click a button inside a listview, it should add a new pane to the accordion control. Here is the code that adds the pane in the onitemcommand event within the listview

var pane = new AccordionPane { ID = key };
pane.HeaderContainer.Controls.Add(new LiteralControl(label.Text));
pane.ContentContainer.Controls.Add(LoadControl("~/UserControls/Covers/" + e.CommandArgument + ".ascx"));
accordion.Panes.Add(pane);

And this will successfully show a webcontrol inside the accordion control. But when I click on another button in the listview, the accordion is reset and it only shows the new pane instead of appending a new pane.

Is there any way to keep the previous pane visible across postbacks like this? By the way, each of the webcontrols that are loaded in the accordion have input fields that will need to be persisted across postbacks as well.

thanks!

© Stack Overflow or respective owner

Related posts about postback

Related posts about ajaxcontroltoolkit