WebPartZoneBase::WebParts Property
Gets the collection of Web Parts controls contained within a zone.
Assembly: System.Web (in System.Web.dll)
[BrowsableAttribute(false)] public: property WebPartCollection^ WebParts { WebPartCollection^ get (); }
Property Value
Type: System.Web.UI.WebControls.WebParts::WebPartCollectionA WebPartCollection that contains references to all the Web Parts controls in a zone.
The WebParts property can contain references to controls that inherit directly from the WebPart class, as well as other ASP.NET server controls or custom controls within a zone. The Web Parts control set dynamically wraps any control that is not a WebPart control as a GenericWebPart control at run time; this mechanism enables you to use all types of ASP.NET controls as Web Parts controls.
The following code example demonstrates the programmatic use of the WebParts property on a WebPartZone control. For the full code example, including the code-behind source file and the .aspx page that contains the zone in this code, see the WebPartZoneBase class overview.
The following code example accesses the WebParts property programmatically and displays a list of the controls contained in WebPartZone1. After you load the page into a browser, click the button labeled List WebPartZone1 WebParts. The IDs and types of the controls are displayed.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.