DeclarativeCatalogPart.WebPartsTemplate 属性

定义

获取或设置对包含在目录中声明的 WebPart 控件的模板的引用。

public:
 property System::Web::UI::ITemplate ^ WebPartsTemplate { System::Web::UI::ITemplate ^ get(); void set(System::Web::UI::ITemplate ^ value); };
[System.ComponentModel.Browsable(false)]
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
[System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.WebParts.DeclarativeCatalogPart))]
public System.Web.UI.ITemplate WebPartsTemplate { get; set; }
[<System.ComponentModel.Browsable(false)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
[<System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.WebParts.DeclarativeCatalogPart))>]
member this.WebPartsTemplate : System.Web.UI.ITemplate with get, set
Public Property WebPartsTemplate As ITemplate

属性值

包含在目录中声明的控件的 ITemplate

属性

示例

下面的代码示例演示了 属性的 WebPartsTemplate 声明性用法。 有关运行示例所需的完整代码,请参阅类概述的 DeclarativeCatalogPart “示例”部分。

此代码演示如何在声明性标记中的 <webpartstemplate> 元素内 <asp:declarativecatalogpart> 插入元素。

<asp:CatalogZone ID="CatalogZone1" runat="server">
  <ZoneTemplate>
    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1"  
      runat="server" 
      Title="Web Parts Catalog"
      ChromeType="TitleOnly" 
      Description="Contains a user control with Web Parts and 
        an ASP.NET Calendar control.">
      <WebPartsTemplate>
        <asp:Calendar ID="Calendar1" runat="server" 
          Title="My Calendar" 
          Description="ASP.NET Calendar control used as a personal calendar." />
        <aspSample:UserInfoWebPart 
          runat="server"   
          id="userinfo1" 
          title = "User Information WebPart"
          Description ="Contains custom, editable user information 
            for display on a page." />
        <aspSample:TextDisplayWebPart 
          runat="server"   
          id="TextDisplayWebPart1" 
          title = "Text Display WebPart" 
          Description="Contains a label that users can dynamically update." />
      </WebPartsTemplate>              
    </asp:DeclarativeCatalogPart>
  </ZoneTemplate>
</asp:CatalogZone>
<asp:CatalogZone ID="CatalogZone1" runat="server">
  <ZoneTemplate>
    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1"  
      runat="server" 
      Title="Web Parts Catalog"
      ChromeType="TitleOnly" 
      Description="Contains a user control with Web Parts and 
        an ASP.NET Calendar control.">
      <WebPartsTemplate>
        <asp:Calendar ID="Calendar1" runat="server" 
          Title="My Calendar" 
          Description="ASP.NET Calendar control used as a personal calendar." />
        <aspSample:UserInfoWebPart 
          runat="server"   
          id="userinfo1" 
          title = "User Information WebPart"
          Description ="Contains custom, editable user information 
            for display on a page." />
        <aspSample:TextDisplayWebPart 
          runat="server"   
          id="TextDisplayWebPart1" 
          title = "Text Display WebPart" 
          Description="Contains a label that users can dynamically update." />
      </WebPartsTemplate>              
    </asp:DeclarativeCatalogPart>
  </ZoneTemplate>
</asp:CatalogZone>

注解

属性 WebPartsTemplate 引用包含网页上声明为目录一部分的控件的模板。 在区域中声明性元素的层次结构中CatalogZone, 属性由 <webpartstemplate> 元素表示,该元素是 元素的<asp:declarativecatalogpart>子元素,并且包含目录中所有显式WebPartsTemplate声明的服务器控件。

适用于

另请参阅