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创建应用程序(转载--海东的技术资料)  
</ZoneTemplate>
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创建应用程序(转载--海东的技术资料)  
<ZoneTemplate>
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创建应用程序(转载--海东的技术资料)  
</ZoneTemplate>
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创建应用程序(转载--海东的技术资料)  
<ZoneTemplate>
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创建应用程序(转载--海东的技术资料)  
</ZoneTemplate>
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
}
1.Web Part 通讯
Web Parts可以相互通讯,提供者发布接口,订阅者通过接口获得数据,WebPartManager 管理通讯,从提供者获得接口,向订阅者发布接口,通讯可以是静态的,也可以是动态的,ConnectionsZone 提供后期绑定的UI
通讯提供者
实现方法返回接口,方法特性 [ConnectionProvider]
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)[ConnectionProvider ("Zip Code""ZipCodeProvider")]
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)
public IZipCode GetZipCodeInterface ()
}
通讯订阅者
实现方法接收接口参数,方法特性 [ConnectionConsumer]
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)[ConnectionConsumer ("Zip Code""ZipCodeConsumer")]
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)
public void GetIZipCodeInterface (IZipCode provider)
}
静态通讯方式
在 WebPartManager的 <StaticConnections> 元素中定义,最终用户无法修改
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)<asp:Connection>的实例
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)
<asp:WebPartManager ID="WebPartManager1" Runat="server">
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)  
<StaticConnections>
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)    
<asp:Connection ID="ZipCodeConnection" Runat="server"
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)      ProviderID
="Weather1" ProviderConnectionPointID="ZipCodeProvider"
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)      ConsumerID
="News1" ConsumerConnectionPointID="ZipCodeConsumer" />
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)  
</StaticConnections>
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)
</asp:WebPartManager>
2.ConnectionsZone 控件
提供供Web Part进行通讯的UI,最终用户,而不是开发人员创建通讯关系
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)<asp:ConnectionsZone ID="ConnectionsZone1"
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)  Runat
="server" />
3.Web Parts 个性化
Web Parts 个性化服务
自动保存相关Web Part的属性 (布局, 外观等等),自动保存标记为 PersonalizableAttribute的定制属性
PersonalizationAdministration 类提供个性化服务的API,Provider-based for flexible data storage
Per-User 个性化,[Personalizable] 为每位用户保存定制属性,string _stocks; // e.g., "MSFT,INTC,AMZN"
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)[WebBrowsable]
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)[Personalizable]
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)
public string Stocks
个性化服务是基于Provider模式
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)使用 SQL Server Provider
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)
<configuration>
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)  
<system.web>
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)    
<webParts>
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)      
<personalization defaultProvider="AspNetSqlPersonalizationProvider" />
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)    
</webParts>
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)  
</system.web>
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)
</configuration>
4 定制Web Parts
增加自定义操作
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)public class MyWebPart : WebPart
}
5.导出Web Part
WebPart.ExportMode属性,WebPartExportMode.None (默认),WebPartExportMode.All
WebPartExportMode.NonSensitiveData,All” 及 “NonSensitiveData” 增加导出操作以便Web Part可以被导出
仅[Personalizable] 属性,PersonalizableAttribute.IsSensitive识别 “sensitive” 属性
导出所有属性
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)public class MyWebPart : WebPart
}
导出所选择的属性
ASP.NET 2.0使用Web Part创建应用程序(转载--海东的技术资料)public class MyWebPart : WebPart
}

相关文章:

  • 2021-10-17
  • 2021-12-09
  • 2022-12-23
  • 2021-05-27
  • 2022-01-05
  • 2021-10-12
  • 2022-02-05
  • 2021-06-20
猜你喜欢
  • 2021-09-25
  • 2022-01-03
  • 2021-08-05
  • 2021-11-11
相关资源
相似解决方案