天天看點

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

 1.WebPartManager 控件

Web Parts的總控中心,管理 Web Parts及區域的清單管理頁面狀态 (比如顯示狀态),當頁面狀态時發生改變時觸發事件,協助Web Parts間的通訊,管理個性化等.

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

<asp:WebPartManager ID="WebPartManager1" RunAt="server" />

2.WebPartZone 控件

在 Web Parts頁面中定義區域,定義每個區域當中Web Part的預設顯示樣式及布局.

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

<asp:WebPartZone ID="WeatherZone"

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

  DragHighlightColor="244,198,96" RunAt="server">

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

  <PartTitleStyle BackColor="#2254B1" ForeColor="White" />

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

  <PartStyle BorderColor="#81AAF2" BorderStyle="Solid" BorderWidth="1px" />

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

  <ZoneTemplate>

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    <!-- Web Parts declared here -->

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

  </ZoneTemplate>

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

</asp:WebPartZone>

3.Web Part Chrome

标題框及Web Part的邊框,通過 WebPartZone 定義其外觀.

4.Web Parts

在 WebPartZone中定義的控件;Web controls, user controls, custom controls

未實作IWebPart接口的控件将封裝進GenericWebParts

增加以下屬性: Title, Description, etc.

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

<ZoneTemplate>

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    <asp:Calendar Title="Calendar" ID="Calendar1" RunAt="server" />

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    <user:Weather Title="Weather" ID="Weather1" RunAt="server" />

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    <custom:Search Title="Search" ID="Search1" RunAt="server" />

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

5.WebPartManager.DisplayMode

設定或者擷取頁面的顯示模式

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

BrowserDisplayMode         “正常的” 顯示模式,無法編輯(預設)

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

DesignDisplayMode            允許拖拽式布局編輯

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

EditDisplayMode                  允許編輯Web Part的外觀及行為

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

CatalogDisplayMode           允許将Web Part添加在另外的頁面上

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

ConnectDisplayMode         允許Web Parts之間進行通訊

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

6.DisplayMode 事件

WebPartManager.DisplayModeChanging 訓示顯示模式是否要發生改變

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

WebPartDisplayModeCancelEventArgs    獲得新的顯示模式并且允許控制者取消這種改變

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

WebPartManager.DisplayModeChanged  訓示顯示模式是否已經發生改變

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

WebPartDisplayModeEventArgs               得到原來的顯示模式

7.其它的區域類型

WebPartZones 定義基本的頁面顯示内容,在任何時間均顯示,其它區域允許頁面可以被編輯,根據顯示模式有條件得進行顯示.

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

CatalogZone            允許使用者在頁面上添加Web Part

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

EditorZone               允許使用者更改Web Part的屬性及布局

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

ConnectionsZone   允許使用者建立Web Part之間的通訊

8.CatalogZone 控件

允許Web Part可以互動式的進行添加,包含一個或者多個 CatalogPart 控件

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

PageCatalogPart               顯示頁面上已經删除的Web Part的清單

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

DeclarativeCatalogPart   顯示聲明在 <WebPartsTemplate>中的Web Part的清單

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

ImportCatalogPart           允許從 .WebPart檔案中導入的Web Part

ASP.NET 2.0使用Web Part建立應用程式之一(共二)
ASP.NET 2.0使用Web Part建立應用程式之一(共二)

聲明 CatalogZone

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

<asp:CatalogZone ID="CatalogZone1" Runat="server">

ASP.NET 2.0使用Web Part建立應用程式之一(共二)
ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    <asp:PageCatalogPart ID="PageCatalogPart1" Runat="server" />

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" Runat="server">

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

      <WebPartsTemplate>

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

        <!-- Declarative Web Parts go here -->

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

      </WebPartsTemplate>

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    </asp:DeclarativeCatalogPart>

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    <asp:ImportCatalogPart ID="ImportCatalogPart1" Runat="server" />

ASP.NET 2.0使用Web Part建立應用程式之一(共二)
ASP.NET 2.0使用Web Part建立應用程式之一(共二)

</asp:CatalogZone>

9.EditorZone控件

允許互動式的對 Web parts進行更改,包含一個或者多個 EditorPart 控件

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

AppearanceEditorPart       提供修改标題及其它界面相關屬性的UI

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

BehaviorEditorPart            提供修改行為屬性的UI 

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

LayoutEditorPart               提供修改Web Part的顯示狀态,區域及區域索引的UI

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

PropertyGridEditorPart     提供修改定制屬性的UI

ASP.NET 2.0使用Web Part建立應用程式之一(共二)
ASP.NET 2.0使用Web Part建立應用程式之一(共二)

聲明 EditorZone

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

<asp:EditorZone ID="EditorZone1" Runat="server">

ASP.NET 2.0使用Web Part建立應用程式之一(共二)
ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    <asp:AppearanceEditorPart ID="AppearanceEditorPart1" Runat="server" />

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    <asp:BehaviorEditorPart ID="BehaviorEditorPart1" Runat="server" />

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    <asp:LayoutEditorPart ID="LayoutEditorPart1" Runat="server" />

ASP.NET 2.0使用Web Part建立應用程式之一(共二)
ASP.NET 2.0使用Web Part建立應用程式之一(共二)

</asp:EditorZone>

10.PropertyGridEditorPart

允許修改自定義屬性的UI顯示标記為 [WebBrowsable]的屬性

string _stocks; // e.g., "MSFT,INTC,AMZN"

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

[WebBrowsable]

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

public string Stocks

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

{

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    get { return _stocks; }

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

    set { _stocks =  value; }

ASP.NET 2.0使用Web Part建立應用程式之一(共二)

}

本文轉自高海東部落格園部落格,原文連結:http://www.cnblogs.com/ghd258/archive/2005/10/10/251585.html,如需轉載請自行聯系原作者

繼續閱讀