Поделиться через


Декларативный синтаксис серверного веб-элемента управления CatalogZone

Служит основным элементом в наборе элементов управления веб-частей для размещения элементов управления CatalogPart на веб-странице.

<asp:CatalogZone
    AccessKey="string"
    AddVerb-Checked="True|False"
    AddVerb-Description="string"
    AddVerb-Enabled="True|False"
    AddVerb-ImageUrl="uri"
    AddVerb-Text="string"
    AddVerb-Visible="True|False"
    BackColor="color name|#dddddd"
    BackImageUrl="uri"
    BorderColor="color name|#dddddd"
    BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge|
        Inset|Outset"
    BorderWidth="size"
    CloseVerb-Checked="True|False"
    CloseVerb-Description="string"
    CloseVerb-Enabled="True|False"
    CloseVerb-ImageUrl="uri"
    CloseVerb-Text="string"
    CloseVerb-Visible="True|False"
    CssClass="string"
    EmptyZoneText="string"
    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"
    HeaderCloseVerb-Checked="True|False"
    HeaderCloseVerb-Description="string"
    HeaderCloseVerb-Enabled="True|False"
    HeaderCloseVerb-ImageUrl="uri"
    HeaderCloseVerb-Text="string"
    HeaderCloseVerb-Visible="True|False"
    HeaderText="string"
    Height="size"
    ID="string"
    InstructionText="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"
    Padding="integer"
    PartChromeType="Default|TitleAndBorder|None|TitleOnly|BorderOnly"
    runat="server"
    SelectedCatalogPartID="string"
    SelectTargetZoneText="string"
    ShowCatalogIcons="True|False"
    SkinID="string"
    Style="string"
    TabIndex="integer"
    ToolTip="string"
    VerbButtonType="Button|Image|Link"
    Width="size"
>
        <EmptyZoneTextStyle/>
        <ErrorStyle/>
        <FooterStyle
            BackColor="color name|#dddddd"
            BorderColor="color name|#dddddd"
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|
                         Double|Groove|Ridge|Inset|Outset"
            BorderWidth="size"
            CssClass="string"
            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"
            Height="size"
            HorizontalAlign="NotSet|Left|Center|Right|
                             Justify"
            OnDisposed="Disposed event handler"
            VerticalAlign="NotSet|Top|Middle|Bottom"
            Width="size"
            Wrap="True|False"
        />
        <HeaderStyle
            BackColor="color name|#dddddd"
            BorderColor="color name|#dddddd"
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|
                         Double|Groove|Ridge|Inset|Outset"
            BorderWidth="size"
            CssClass="string"
            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"
            Height="size"
            HorizontalAlign="NotSet|Left|Center|Right|
                             Justify"
            OnDisposed="Disposed event handler"
            VerticalAlign="NotSet|Top|Middle|Bottom"
            Width="size"
            Wrap="True|False"
        />
        <PartChromeStyle/>
        <PartStyle
            BackColor="color name|#dddddd"
            BackImageUrl="uri"
            BorderColor="color name|#dddddd"
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|
                         Double|Groove|Ridge|Inset|Outset"
            BorderWidth="size"
            CellPadding="integer"
            CellSpacing="integer"
            CssClass="string"
            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"
            GridLines="None|Horizontal|Vertical|Both"
            Height="size"
            HorizontalAlign="NotSet|Left|Center|Right|
                            Justify"
            OnDisposed="Disposed event handler"
            Width="size"
        />
        <PartTitleStyle
            BackColor="color name|#dddddd"
            BorderColor="color name|#dddddd"
            BorderStyle="NotSet|None|Dotted|Dashed|Solid|
                         Double|Groove|Ridge|Inset|Outset"
            BorderWidth="size"
            CssClass="string"
            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"
            Height="size"
            HorizontalAlign="NotSet|Left|Center|Right|
                            Justify"
            OnDisposed="Disposed event handler"
            VerticalAlign="NotSet|Top|Middle|Bottom"
            Width="size"
            Wrap="True|False"
        />
        <VerbStyle />
        <EditUIStyle />
        <HeaderCloseVerb
            Checked="True|False"
            Description="string"
            Enabled="True|False"
            ImageUrl="uri"
            Text="string"
            Visible="True|False"
        />
        <HeaderVerbStyle />
        <InstructionTextStyle />
        <LabelStyle />
        <AddVerb
            Checked="True|False"
            Description="string"
            Enabled="True|False"
            ImageUrl="uri"
            Text="string"
            Visible="True|False"
        />
        <CloseVerb
            Checked="True|False"
            Description="string"
            Enabled="True|False"
            ImageUrl="uri"
            Text="string"
            Visible="True|False"
        />
        <PartLinkStyle />
        <SelectedPartLinkStyle />
        <ZoneTemplate>
            <!-- child controls -->
        </ZoneTemplate>
</asp:CatalogZone>

Заметки

В наборе элементов управления веб-частей зоной называется область на веб-странице, содержащая элементы управления веб-частей. Зона веб-частей создается элементом управления-зоной, которая является типом элемента CompositeControl, предназначенным для размещения других элементов управления. Основные функции зоны — расположение содержащихся в ней элементов управления в соответствии с макетом, а также предоставление для них общего пользовательского интерфейса. Общие сведения о зонах и о том, как они используются в приложениях веб-частей, см. в описании базового класса WebZone и в разделе Общие сведения о наборе элементов управления веб-частей.

Дополнительные сведения об элементе управления CatalogZone и других элементах управления зоны веб-частей см. в разделе Элементы управления веб-частей ASP.NET.

Пример

В следующем примере кода демонстрируется использование элемента управления CatalogZone. Веб-страница разрешает пользователям добавлять элемент управления Calendar или CreateUserWizard в зону веб-частей.

<%@ 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>

См. также

Ссылки

CatalogZone

Другие ресурсы

Элементы управления веб-частей ASP.NET