共用方式為


PageCatalogPart Web 伺服器控制項宣告式語法

提供一個目錄,用以保存至使用者已在單一 Web 組件頁面上關閉之所有 WebPart 控制項 (以及包含在 WebPartZoneBase 區域中之其他伺服器控制項) 的參考,這可讓使用者將已關閉的控制項重新加入至頁面。

<asp:PageCatalogPart
    AccessKey="string"
    BackColor="color name|#dddddd"
    BackImageUrl="uri"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
                 Inset|Outset"
    BorderWidth="size"
    ChromeState="Normal|Minimized"
    ChromeType="Default|TitleAndBorder|None|TitleOnly|BorderOnly"
    CssClass="string"
    DefaultButton="string"
    Description="string"
    Direction="NotSet|LeftToRight|RightToLeft"
    Enabled="True|False"
    EnableTheming="True|False"
    EnableViewState="True|False"
    Font-Bold="True|False"
    Font-Italic="True|False"
    Font-Names="string"
    Font-Overline="True|False"
    Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium|
               Large|X-Large|XX-Large"
    Font-Strikeout="True|False"
    Font-Underline="True|False"
    ForeColor="color name|#dddddd"
    GroupingText="string"
    Height="size"
    HorizontalAlign="NotSet|Left|Center|Right|Justify"
    ID="string"
    OnDataBinding="DataBinding event handler"
    OnDisposed="Disposed event handler"
    OnInit="Init event handler"
    OnLoad="Load event handler"
    OnPreRender="PreRender event handler"
    OnUnload="Unload event handler"
    runat="server"
    ScrollBars="None|Horizontal|Vertical|Both|Auto"
    SkinID="string"
    Style="string"
    TabIndex="integer"
    Title="string"
    ToolTip="string"
    Visible="True|False"
    Width="size"
    Wrap="True|False"
/>

備註

PageCatalogPart 類別在 Web 組件頁面上可用於一項特定用途:它可當做維護任何先前已由使用者關閉後又加入至頁面之控制項的頁面目錄使用,以便使用者可將這些控制項加入回頁面。 此控制項僅在 Web 網頁處於目錄顯示模式中時可見,這是一種特殊的檢視,可以讓使用者在頁面上加入及移除控制項。 若要為使用者提供在頁面上關閉和重新開啟控制項的彈性,請將 PageCatalogPart 控制項加入至頁面。 如果頁面不允許使用者關閉控制項,則不需要將 PageCatalogPart 控制項加入至頁面。

如需 PageCatalogPart 和其他 Web 組件控制項的詳細資訊,請參閱 ASP.NET Web 組件控制項

範例

下列程式碼範例將示範如何使用 PageCatalogPart 控制項。 此 Web 網頁允許使用者對 Web 組件區域加入 CalendarCreateUserWizard 控制項。

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        mgr1.DisplayMode = WebPartManager.BrowseDisplayMode
    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        mgr1.DisplayMode = WebPartManager.CatalogDisplayMode
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Label1.Text = "Scope is: " _
   + mgr1.Personalization.Scope.ToString()
    End Sub
</script>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
    <title>Web Parts Declarative Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:WebPartManager ID="mgr1" runat="server">
        <Personalization InitialScope="Shared" Enabled="True" />
      </asp:WebPartManager>

      <asp:WebPartZone ID="WebPartZone1" runat="server" 
        EmptyZoneText="No parts to show.">
        <ZoneTemplate>
        </ZoneTemplate>
        <CloseVerb Text="Close This Part" />
        <MinimizeVerb Text="Minimize This Part" />
        <EditVerb Text="Edit This Part" />
      </asp:WebPartZone>

      <asp:CatalogZone ID="CatalogZone1" runat="server" >
        <ZoneTemplate>
          <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
          <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
            runat="server">
            <WebPartsTemplate>
              <asp:Calendar id="Calendar1" runat="server" /> 
              <asp:CreateUserWizard ID="CreateUserWizard1" 
                runat="server" />
            </WebPartsTemplate>
          </asp:DeclarativeCatalogPart>
          <asp:ImportCatalogPart ID="ImportCatalogPart1" runat="server"/>
        </ZoneTemplate>
      </asp:CatalogZone>

      <hr />
      <asp:Button ID="Button1" runat="server" 
        Text="Browse Mode" OnClick="Button1_Click" />
      <asp:Button ID="Button2" runat="server" 
        Text="Catalog Mode" OnClick="Button2_Click" /><br />
      <asp:Label ID="Label1" runat="server" Text="" />
    </div>
    </form>
</body>
</html>
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
  protected void Button1_Click(object sender, EventArgs e)
  {
    mgr1.DisplayMode = WebPartManager.BrowseDisplayMode;
  }

  protected void Button2_Click(object sender, EventArgs e)
  {
    mgr1.DisplayMode = WebPartManager.CatalogDisplayMode;
  }

  protected void Page_Load(object sender, EventArgs e)
  {
    Label1.Text = "Scope is: "
      + mgr1.Personalization.Scope.ToString();
  }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="head1" runat="server">
    <title>Web Parts Declarative Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:WebPartManager ID="mgr1" runat="server">
        <Personalization InitialScope="Shared" Enabled="True" />
      </asp:WebPartManager>

      <asp:WebPartZone ID="WebPartZone1" runat="server" 
        EmptyZoneText="No parts to show.">
        <ZoneTemplate>
        </ZoneTemplate>
        <CloseVerb Text="Close This Part" />
        <MinimizeVerb Text="Minimize This Part" />
        <EditVerb Text="Edit This Part" />
      </asp:WebPartZone>

      <asp:CatalogZone ID="CatalogZone1" runat="server" >
        <ZoneTemplate>
          <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
          <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
            runat="server">
            <WebPartsTemplate>
              <asp:Calendar id="Calendar1" runat="server" /> 
              <asp:CreateUserWizard ID="CreateUserWizard1" 
                runat="server" />
            </WebPartsTemplate>
          </asp:DeclarativeCatalogPart>
          <asp:ImportCatalogPart ID="ImportCatalogPart1" runat="server"/>
        </ZoneTemplate>
      </asp:CatalogZone>

      <hr />
      <asp:Button ID="Button1" runat="server" 
        Text="Browse Mode" OnClick="Button1_Click" />
      <asp:Button ID="Button2" runat="server" 
        Text="Catalog Mode" OnClick="Button2_Click" /><br />
      <asp:Label ID="Label1" runat="server" Text="" />
    </div>
    </form>
</body>
</html>

請參閱

參考

PageCatalogPart

其他資源

ASP.NET Web 組件控制項