Matt Gibbs ASP.NET Development Manager ASP.NET 2.0 Web Parts Matt Gibbs ASP.NET Development Manager
Why Web Parts Technology for building portal-type sites Foundation for Sharepoint 3.0 For The Site User: Customizable layout Personalized view For The Developer: Personalization infrastructure Extensibility Composable UI For The Administator Flexibility and Control Add Web Parts to Site Over Time
What are Web Parts
Web Parts Basics WebPart WebPartZone WebPartManager UI element with customizable portal behaviors WebPartZone Region to contain and layout groups of Web Parts Renders elements common to individual Web Parts WebPartManager Required for a WebParts page Manages Display Mode: Browse, Design, Edit, Catalog, Connection Manages WebPart State: Add, Close, Delete, Move
Browsing a Web Parts Site demo Browsing a Web Parts Site
Creating A Web Part Options: Benefit from common UI “look and feel” Any ASP.NET Server control Any User Control Any custom WebControl Any custom control derived from WebPartBase Benefit from common UI “look and feel” Become personalizable
demo Create Web Parts
Web Part UI Elements Web Part’s UI elements Verbs UI elements that enable users to perform actions WebPartZone provides standard verbs Close, Minimize, Restore, Help, Edit, Connect, Export WebPart developer can add custom verbs TitleIcon Title Verbs Content Chrome
Customizing Web Part UI Derive from WebPart base class Override properties AllowClose, AllowMinimize, DisplayTitle, … Implement Interfaces IWebPart Title, Substitle, TitleUrl, Description, CatalogIconImageUrl, TitleIconImageUrl IWebActionable Verbs
demo Customize Web Parts UI
Web Part Catalogs Declarative Catalog Part Page Catalog Part Statically defined set of available parts Page Catalog Part Closed parts Import Catalog Part Move parts and shared data between servers Programmatically add/delete Web Parts WebPartManager.AddWebPart(webPart,zone,zoneIndex) WebPartManager.DeleteWebPart(WebPart webPart)
Web Zones and Display Mode Web Part Zones are always displayed Others shown according to Display Mode CatalogZone in Catalog Display Mode ConnectionZone in Connection Display Mode EditorZone in Edit Display Mode Design Mode allows moving parts between and within zones
demo Create A Catalog
Web Parts Personalization Persists and Retrieves property values Shared User Data Per User Data Attributes define Personalizable Properties [Personalizable], [WebBrowsable] [WebDescription], [WebDisplayName] Data saved per user per page
Core Concepts Personalization <configuration> <system.web> <webParts> <personalization> <authorization> <deny users="*" verbs="enterSharedScope"/> <allow users="*" verbs="modifyState" /> </authorization> </personalization> </webParts> </system.web> </configuration> Configuration Files Web.config or Machine.config.
Web Parts Editor Personalize Web Parts using Editor Parts in the Editor Zone AppearanceEditorPart BehaviorEditorPart LayoutEditorPart PropertyGridEditorPart
Make Web Parts Personalizable demo Make Web Parts Personalizable
Web Part Connections Wire up multiple Web Parts Provider and Consumer model Dynamic and Static Connections Define the callbacks for exchanging data
Summary Browse Design Edit Catalog Connection
Questions