Ajax Control Toolkit Accordion Control
Modified on 2010/05/04 19:28 by Stephen Walther — Categorized as: Uncategorized
The Accordion control lets you define multiple panes and display them one at a time. It is like having several
controls where only one can be expanded at a time. The Accordion control contains one or more AccordionPane controls. Each AccordionPane control has a template for its header and its content. The selected pane is automatically persisted across postbacks.
The Accordion control supports the following
modes to accommodate a variety of page layouts.
- The Accordion control grows and shrinks without restriction. This can cause other elements on the page to move up and down in order to accommodate the Accordion control.
- The Accordion control never grows larger than the value specified by its
property. This causes the content to scroll if the content is too long to be displayed in the allotted space.
- The Accordion control is a fixed size as specified in its
property. This causes the content to be expanded or shrunk if the content does not fit exactly into the allotted space.
Like most of the extenders in the AJAX Control Toolkit, the Accordion control is written using an extender. The extender requires input in a specific hierarchy of container elements (like
elements). Therefore, the Accordion and AccordionPane controls are used to generate the expected input for the extender. The extender can also be used on its own if you provide appropriate input.
The Accordion control can also be data-bound. To bind the control, specify a data source using the
properties, and then set the data items in the
properties. You must call the
method to bind the control to the data.
Creating a Simple Accordion