WebPartZoneBase.GetInitialWebParts 方法


根据模板或某种存储介质获取区域中包含的 WebPart 控件的初始集合。Gets an initial collection of WebPart controls contained in a zone, based on a template or some storage medium.

protected public:
 abstract System::Web::UI::WebControls::WebParts::WebPartCollection ^ GetInitialWebParts();
protected internal abstract System.Web.UI.WebControls.WebParts.WebPartCollection GetInitialWebParts ();
abstract member GetInitialWebParts : unit -> System.Web.UI.WebControls.WebParts.WebPartCollection
Protected Friend MustOverride Function GetInitialWebParts () As WebPartCollection


包含属于某个区域的 WebPartCollection 控件的初始集合的 WebPartA WebPartCollection that contains the initial set of WebPart controls that belong in a zone.


仅当存在一个确定区域中的控件的预先存在的模板或其他形式的存储时,GetInitialWebParts 方法才能获取区域的 WebPart 控件的初始集合。The GetInitialWebParts method gets the initial collection of WebPart controls for a zone only if there is a preexisting template or other form of storage that determines what controls are in the zone. 方法不反映任何个性化设置更改,这可能意味着初始集合中的控件实际上已由用户移动到另一个区域。The method does not reflect any personalization changes, which might mean that controls in the initial collection have actually been moved by a user into another zone.

区域中 WebPart 控件的初始集合与区域的 WebParts 属性中包含的集合不一定相同,在呈现页面时,它反映区域中控件的实际当前集合,考虑到所做的任何个性化更改。The initial collection of WebPart controls in the zone are not necessarily the same as the collection contained in the WebParts property of the zone, which reflects the actual current collection of controls in the zone when a page is rendered, taking into account any personalization changes that have been made.


GetInitialWebParts() 方法是抽象的,因此它必须由派生类实现。The GetInitialWebParts() method is abstract, so it must be implemented by derived classes. WebPartZone 类的 GetInitialWebParts() 方法包含方法的一个实现。The GetInitialWebParts() method of the WebPartZone class contains one implementation of the method.