1.WebPartManager 控制項
Web Parts的總控中心,管理 Web Parts及地區的列表管理頁面狀態 (比如顯示狀態),當頁面狀態時發生改變時觸發事件,協助Web Parts間的通訊,管理個人化等.
<asp:WebPartManager ID="WebPartManager1" RunAt="server" />
2.WebPartZone 控制項
在 Web Parts頁面中定義地區,定義每個地區當中Web Part的預設顯示樣式及布局.<asp:WebPartZone ID="WeatherZone"
DragHighlightColor="244,198,96" RunAt="server">
<PartTitleStyle BackColor="#2254B1" ForeColor="White" />
<PartStyle BorderColor="#81AAF2" BorderStyle="Solid" BorderWidth="1px" />
<ZoneTemplate>
<!-- Web Parts declared here -->
</ZoneTemplate>
</asp:WebPartZone>
3.Web Part Chrome
標題框及Web Part的邊框,通過 WebPartZone 定義其外觀.
4.Web Parts
在 WebPartZone中定義的控制項;Web controls, user controls, custom controls
未實現IWebPart介面的控制項將封裝進GenericWebParts
增加以下屬性: Title, Description, etc.
<ZoneTemplate>
<asp:Calendar Title="Calendar" ID="Calendar1" RunAt="server" />
<user:Weather Title="Weather" ID="Weather1" RunAt="server" />
<custom:Search Title="Search" ID="Search1" RunAt="server" />
</ZoneTemplate>
5.WebPartManager.DisplayMode
設定或者擷取頁面的顯示模式BrowserDisplayMode “正常的” 顯示模式,無法編輯(預設)
DesignDisplayMode 允許拖拽式布局編輯
EditDisplayMode 允許編輯Web Part的外觀及行為
CatalogDisplayMode 允許將Web Part添加在另外的頁面上
ConnectDisplayMode 允許Web Parts之間進行通訊
6.DisplayMode 事件
WebPartManager.DisplayModeChanging 指示顯示模式是否要發生改變WebPartDisplayModeCancelEventArgs 獲得新的顯示模式並且允許控制者取消這種改變
WebPartManager.DisplayModeChanged 指示顯示模式是否已經發生改變
WebPartDisplayModeEventArgs 得到原來的顯示模式
7.其它的地區類型
WebPartZones 定義基本的頁面顯示內容,在任何時間均顯示,其它地區允許頁面可以被編輯,根據顯示模式有條件得進行顯示.CatalogZone 允許使用者在頁面上添加Web Part
EditorZone 允許使用者更改Web Part的屬性及布局
ConnectionsZone 允許使用者建立Web Part之間的通訊
8.CatalogZone 控制項
允許Web Part可以互動進行添加,包含一個或者多個 CatalogPart 控制項PageCatalogPart 顯示頁面上已經刪除的Web Part的列表
DeclarativeCatalogPart 顯示聲明在 <WebPartsTemplate>中的Web Part的列表
ImportCatalogPart 允許從 .WebPart檔案中匯入的Web Part
聲明 CatalogZone
<asp:CatalogZone ID="CatalogZone1" Runat="server">
<ZoneTemplate>
<asp:PageCatalogPart ID="PageCatalogPart1" Runat="server" />
<asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" Runat="server">
<WebPartsTemplate>
<!-- Declarative Web Parts go here -->
</WebPartsTemplate>
</asp:DeclarativeCatalogPart>
<asp:ImportCatalogPart ID="ImportCatalogPart1" Runat="server" />
</ZoneTemplate>
</asp:CatalogZone>
9.EditorZone控制項
允許互動對 Web parts變更,包含一個或者多個 EditorPart 控制項AppearanceEditorPart 提供修改標題及其它介面相關屬性的UI
BehaviorEditorPart 提供修改行為屬性的UI
LayoutEditorPart 提供修改Web Part的顯示狀態,地區及地區索引的UI
PropertyGridEditorPart 提供修改定製屬性的UI
聲明 EditorZone
<asp:EditorZone ID="EditorZone1" Runat="server">
<ZoneTemplate>
<asp:AppearanceEditorPart ID="AppearanceEditorPart1" Runat="server" />
<asp:BehaviorEditorPart ID="BehaviorEditorPart1" Runat="server" />
<asp:LayoutEditorPart ID="LayoutEditorPart1" Runat="server" />
</ZoneTemplate>
</asp:EditorZone>
10.PropertyGridEditorPart
允許修改自訂屬性的UI顯示標記為 [WebBrowsable]的屬性
string _stocks; // e.g., "MSFT,INTC,AMZN"
[WebBrowsable]
public string Stocks
{
get { return _stocks; }
set { _stocks = value; }
}