Dec 7, 2010 at 11:35 PM


I have been trying to add a new layout element that could be useful to have - the AjaxControlToolKit.Accordian.

The problem here is that the AccordianPanel.ContentContainer (which is an ITemplate) does not have a setter.

My attempt to get around this was to create System.Web.UI.WebControls.Panels for each Child LayoutElement.  This fails becuase the binding if the controls to the data is upset by having the extra layer of panel controls.

here is my code for the override of InstantiateTemplateCore:

If anyone has some ideas on getting this to work (prefer to not to start changing source of Accordian) please post here - thanks in advance :-)


Perth, Australia


        protected override void InstantiateTemplateCore(LayoutDefinition definition, Control container)
            Accordion accordion = new Accordion() { ID = "Accordian" };
            accordion.TransitionDuration = 250;
            accordion.FadeTransitions = true;
            accordion.RequireOpenedPane = false;
            accordion.SelectedIndex = -1;

            AccordionPane accordionPane = new AccordionPane() { ID = "AccordionPane" };

            Label headerLabel = new Label();
            headerLabel.Text = "test";

            // instantiate contents
            foreach (LayoutElement element in Children)

                //comment out as not setter available...
                //accordionPane.ContentContainer = new TabsElementTemplate(definition, element);

                Panel panel = new Panel() { Width = Unit.Empty, Height = Unit.Empty };

                // instantiate contents
                element.InstantiateTemplate(definition, panel);


Dec 8, 2010 at 9:17 AM


actually the line should like like this:

child.InstantiateTemplate(definition, pane.ContentContainer);

I tried to write the AccordionElement but the control inside Accordion panes somehow do not databind. When I open the edit page the textboxes inside Accordion panes are blank although the fields contains values in the database. When I try to update the fields the values are not extracted - textboxes in the Accordion have their values after postback but the validators fail with message that "field cannot be null".

I tried to override the FormView's ExtractRowValues method that does this stuff but in this method the fields are extracted correctly into the dictionary. So this must be a bug in the Dynamic Data or the Accordion control. I suspect the Accordion because almost all controls in the AjaxControlToolkit are pretty buggy.

Maybe we can make the Accordion using another implementation, like this jQuery plugin - http://plugins.jquery.com/project/accordion.

I don't have much time this week but I can dive into it the following one.


Tomas Herceg

Dec 9, 2010 at 12:16 AM

Hi Tomas,

thanks for looking at this.

kind of glad despite my mistake i can blame some of it on the control :-)