CollapsiblePanel控件,該控件可以顯示或者隱藏某一指定的頁面面板內的內容。
<%...@ Page Language="C#" AutoEventWireup="true" CodeFile="CollapsiblePanelDemo.ASPx.cs"
Inherits="CollapsiblePanelDemo" %>
<%...@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="ASP" %>
<%...@ Register Assembly="AjaxControlToolkit" Namespace="AJaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHtml 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xHtml1-transitional.dtd">
<html XMLns="http://www.w3.org/1999/xHtml" >
<head runat="server">
<title>無標題頁</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ASP:ScriptManager ID="ScriptManager1" runat="server">
</ASP:ScriptManager>
<ASP:Panel ID="Panel2" runat="server" Height="30px">
<div style=
"padding:5px; cursor: pointer; vertical-align: middle;">
<div >折疊標題</div>
<div ><asp:Label ID="Label1" runat="server">(展開...)</ASP:Label></div>
<div ><ASP:Image ID="Image1"
runat="server" ImageUrl="~/images/expand.jpg"/></div>
</div>
</ASP:Panel>
<ASP:Panel ID="Panel1" runat="server" Height="0">
<br />
<p>
展開內容
</p>
</ASP:Panel>
</div>
<cc1:CollapsiblePanelExtender ID="cpeDemo" runat="Server"
TargetControlID="Panel1"
ExpandControlID="Panel2"
CollapseControlID="Panel2"
Collapsed="True"
TextLabelID="Label1"
ExpandedText="(隱藏...)"
CollapsedText="(展開...)"
ImageControlID="Image1"
ExpandedImage="~/images/collapse.jpg"
CollapsedImage="~/images/expand.jpg"
SuppressPostBack="true" />
</form>
</body>
</Html>