在AJAX Toolkits中有个CollapsiblePanel扩展控件,该扩展功能仅限于Panel控件。
通过该控件可以实现Panel的收缩,该功能是由外部驱动的。其包含以下属性:
- TargetControlID - Panel的控件编号
- CollapsedSize - 数字型,当Panel属于折叠状态是的高度,一般来说,该属性都不设置,默认为0
- ExpandedSize - 数字型,当Panel属于折叠状态是的高度,一般来说,该属性都不设置,因为他会取原先Panel的高度
- Collapsed - 布尔型,初始状态下是否为折叠状态,默认为false
- AutoCollapse - 布尔型,当鼠标移动到Panel,是否自动折叠,默认为false.
- AutoExpand - 布尔型,当鼠标移动到Panel,是否自动展开,默认为false.
- ScrollContents - 布尔型,当内容大于Panel本身时,如果设置True就会出现滚轮,如果为False,则全部显示
- ExpandControlID/CollapseControlID - 控件的ID,通过点击该控件可以实现对Panel的折叠和展开。如果两者设置为同一控件,那么系统会自动循环执行
- TextLabelID - Label控件的编号,其是用来显示当前Panel的状态信息。该信息与后面的CollapsedText和ExpandedText关联。
- CollapsedText - 当Panel处于折叠状态下,在状态显示控件(TextLabelID所对应的控件)上的内容。
- ExpandedText - 当Panel处于打开状态下,在状态显示控件(TextLabelID所对应的控件)上的内容。
- ImageControlID - The ID of an Image control where an icon indicating the collapsed status of the panel will be placed. The extender will replace the source of this Image with the CollapsedImage and ExpandedImage urls as appropriate. If the ExpandedText or CollapsedText properties are set, they are used as the alternate text for the image.
- CollapsedImage - The path to an image used by ImageControlID when the panel is collapsed
- ExpandedImage - The path to an image used by ImageControlID when the panel is expanded
(上述三项我没有使用) - ExpandDirection - 有"Vertical" 和"Horizontal"两个选项,用来确定Panel展开或折叠的方向
- SuppressPostBack - 将该属性设置为true,这样panal在展開時才不會postback,不会刷页面
代码示例:
![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
1
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/dot.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/dot.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
21
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
22
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
23
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
24
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
25
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
26
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)