Custom Search

CollapsiblePanel Extender

The extender builds up a collapsible section in your pages by combining two panels—one acting as the content panel, and one being the expand/collapse controller. In its simplest form, the CollapsiblePanel extender looks like the following code sample:

act:CollapsiblePanelExtender ID="CollPanel" runat="server" TargetControlID="ContentPanel"

As usual, the TargetControlID property sets the target panel to expand or collapse.
ExpandControlID and CollapseControlID indicate the panel to use to expand and collapse the content panel. Note the extreme flexibility of the component design—it might not make sense in all cases, but you can use different panels to control the expansion and collapsing of the content panel. In most cases, though, you’ll be using the same header panel with an image button that changes according to the state of the content panel. The following code snippet shows a more complete usage for the extender:

act:CollapsiblePanelExtender ID="cpe" runat="server"

The ImageControlID indicates the Image control, if any, that if clicked causes the panel to expand or collapse. The ExpandedImage and CollapsedImage properties set the URL of the images to use to expand and collapse. Likewise, CollapsedText and ExpandedText set the Tool-Tip text for the image. Collapsed sets the state of the panel, whereas ExpandDirection indicates whether the panel expands horizontally or vertically. Figure provides a view of the control in action.

The following code demonstrates a typical pair of Panel controls used with the extender:

asp:Panel ID="CollapsibleCustomersPanel" runat="server">
ImageUrl="~/images/collapse.jpg" />
asp:Panel ID="CollapsibleCustomersPanelContent" runat="server"
Height="0" CssClass="collapsePanel">

Unlike draggable panels, the header and content panels are distinct and are typically placed
one after the next in the page layout. The extender panel is also postback aware, meaning that,
on a client postback, it automatically records and restores its collapsed/expanded client state.
Your Ad Here