CollapsiblePanel Reference

Modified on 2010/05/04 16:34 by Stephen Walther — Categorized as: Uncategorized

CollapsiblePanelExtender Server Reference

An extender class which adds collapse/expand behavior to an ASP.NET Panel control. The panel that is extended can then be collapsed or expanded by the user of the page, which is handy for doing things like showing or hiding content or maximizing available space.

CollapsiblePanelExtender Server Properties

NameDescription
AutoCollapse If true, and the panel is in its 'expanded' state, the panel will automatically collapse when the mouse pointer moves off of the panel.
AutoExpand If true, and the panel is in its 'collapsed' state, the panel will automatically expand when the mouse pointer moves into the panel.
CollapseControlID The server ID of the control to initiate the collapse of the target panel. The panel will collapse when this control fires its client side "onclick" event. If this value is the same as the value for "ExpandControlID", the CollapsiblePanel will toggle when this control is clicked.
Collapsed Signals the initial collapsed state of the control. Note this will not cause an expanded control to collapse at initialization, but rather tells the extender what the initial state of the Panel control is.
CollapsedImage Image to be displayed when the Panel is collapsed and the ImageControlID is set
CollapsedSize The size of the panel when it is in it's collapsed state. To avoid flicker when your page initializes, set the initial height (or width) of your Panel control to match this value, and set the Collapsed property to 'true'. The default value is -1, which indicates that the CollapsiblePanel should initialize the CollapsedSize based on the initial size of the object.
CollapsedText The text to display in the collapsed state. When the panel is collapsed, the internal contents (anything between the start and ending tags) of the control referenced by the TextLabelID property will be replaced with this text. This collapsed text is also used as the alternate text of the image if ImageControlID is set.
ExpandControlID The server ID of the control to initiate the expansion of the target panel. The panel will opening when this control fires its client side "onclick" event. If this value is the same as the value for "CollapseControlID", the CollapsiblePanel will toggle when this control is clicked.
ExpandDirection The dimension to use for collapsing and expanding - vertical or horizontal.
ExpandedImage Image to be displayed when the Panel is expanded and the ImageControlID is set
ExpandedSize The size of the panel when it is in it's opened state. To avoid flicker when your page initializes, set the initial width of your Panel control to match this value, and set the Collapsed property to 'false'. The default value is -1, which indicates that the CollapsiblePanel should initialize the ExpandedSize based on the parent div offsetheight if aligned vertically and parentdiv offsetwidth if aligned horizonatally.
ExpandedText The text to display in the expanded state. When the panel is expanded, the internal contents (anything between the start and ending tags) of the control referenced by the TextLabelID property will be replaced with this text. This expanded text is also used as the alternate text of the image if ImageControlID is set.
ImageControlID The ID of an image control to display the current state of the Panel. When the collapsed state of the panel changes, the image source will be changed from the ExpandedImage to the CollapsedImage. We also use the ExpandedText and CollapsedText as the image's alternate text if they are provided.
ScrollContents Determines whether the contents of the panel should be scrolled or clipped if they do not fit into the expanded size.
SuppressPostBack Determines whether the CollapsiblePanelBehavior should suppress the click operations of the controls referenced in CollapseControlID and/or ExpandControlID. By default, this value is false, except for anchor ("A") tags.
TextLabelID The ID of a label control to display the current state of the Panel. When the collapsed state of the panel changes, the entire HTML contents (anything between the start and ending tags of the label) will be replaced with the status text.

CollapsiblePanelExtender Server Methods

NameDescription
Constructor Default constructor to enable client state

CollapsiblePanelBehavior Client Reference

The CollapsiblePanelBehavior allows you to add collapsible sections to your page

CollapsiblePanelBehavior Client Properties

NameDescription
AutoCollapseWhether to automatically collapse the target when the mouse is moved off of it
AutoExpandWhether to automatically expand the target when the mouse is moved over it
CollapseControlIDID of the control used to collapse the target when clicked
CollapsedWhether or not the panel is collapsed
CollapsedImagePath to an image to show in the element specified by ImageControlID when the target is collapsed
CollapsedSizeThe size of the target, in pixels, when it is in the collapsed state
CollapsedTextText to show in the element specified by TextLabelID when the target is collapsed. This text is also used as the alternate text of the image if ImageControlID has been provided.
ExpandControlIDID of the control used to expand the target when clicked
ExpandDirectionDirection the panel will expand and collapse (can be either "Vertical" or "Horizontal")
ExpandedImagePath to an image to show in the element specified by ImageControlID when the target is expanded
ExpandedSizeThe size of the target, in pixels, when it is in the expanded state
ExpandedTextText to show in the element specified by TextLabelID when the target is expanded. This text is also used as the alternate text of the image if ImageControlID has been provided.
ImageControlID
ScrollContentsWhether to add a scrollbar when the contents are larger than the target (the contents will be clipped if false)
SuppressPostBackWhether or not to suppress postbacks generated when the CollapseControlID or ExpandControlID elements are clicked
TargetHeightWrap the height of the panel
TargetWidthWrap the width of the panel
TextLabelIDID of the element where the "status text" for the target will be placed

CollapsiblePanelBehavior Client Methods

NameDescription
collapsePanel Collapse the panel. Public function that users should call if they wish to operate the collapsible panel programmatically. _doClose should be treated as private since it has an underscore to begin the function name.
dispose Dispose the behavior
expandPanel Open the panel. Public function that users should call if they wish to operate the collapsible panel programmatically. _doOpen should be treated as private since it has an underscore to begin the function name.
initialize Initialize the behavior
raiseCollapseComplete Raise the collapseComplete event
raiseCollapsed Raise the collapsed event
raiseCollapsing Raise the collapsing event
raiseExpandComplete Raise the expandComplete event
raiseExpanded Raise the expanded event
raiseExpanding Raise the expanding event
togglePanel Event handler to epxand or collapse the panel (based on its current state) This is the public function that should be called instead of _toggle if you wish to programmatically open and close the collapsible panel.

CollapsiblePanelBehavior Client Events

NameDescription
collapseComplete Add a handler to the collapseComplete event
collapsed Add an event handler for the collapsed event
collapsing Add an event handler for the collapsing event
expandComplete Add a handler to the expandComplete event
expanded Add an event handler for the expanded event
expanding Add an event handler for the expanding event