共用方式為


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 範例一節。

此程式代碼示範如何在宣告式標記的 <asp:declarativecatalogpart> 元素內插入<webpartstemplate>專案。

<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 屬性是由 <webpartstemplate> 元素表示,該元素是 元素的 <asp:declarativecatalogpart> 子元素,並包含目錄中所有明確宣告的伺服器控件。

適用於

另請參閱