WebPartZone.GetInitialWebParts Method ()
Overrides the abstract base method and gets the initial set of static WebPart controls contained within the zone's template.
Assembly: System.Web (in System.Web.dll)
The GetInitialWebParts method. The base method provides no implementation, but declares the method so that derived classes can customize how they will get the initial set of controls that belong in a zone, without taking personalization changes into account.method provides an implementation of the abstract base
For each server control found in the zone, the CreateWebPart method is called. If a control inherits directly from the WebPart class, it is simply added to the zone's WebParts collection (and to the similar collection of the WebPartManager control). If a control does not inherit directly from WebPart, the Web Parts control set wraps the control with a GenericWebPart object, which enables the control to behave as a WebPart control at run time.
The WebPartZone class implements the base method by returning the set of controls (if any) that are statically declared within a set of <zonetemplate> tags in the markup of a Web Parts page. If a PlaceHolder control is declared in a zone, the child controls of that control are added, rather than the control itself. This implementation allows you to, for example, create a WebPartZone zone in a master page, and then declare individual WebPart or server controls in a content page. If you declare Literal controls in a WebPartZone zone, they are ignored.
The initial collection of controls returned by the WebPartZone controls, and the first one contains user control named User1 that is statically declared within the <zonetemplate> tags. If a user loads the page and drags User1 into the second zone, then User1 is still part of the collection that is returned by calling the method for the first zone, because it is declared in that zone. But at run time, when the WebPartManager control loads the personalization data, User1 actually appears in the second zone where the user dragged it.method might be different from the actual run-time collection of controls in a zone, after personalization has taken place. For example, suppose you have a Web page with two
Available since 2.0