Επεξεργασία

Κοινή χρήση μέσω


WebPartPersonalization.Load Method

Definition

Initializes personalization.

protected:
 virtual System::Web::UI::WebControls::WebParts::PersonalizationScope Load();
protected virtual System.Web.UI.WebControls.WebParts.PersonalizationScope Load ();
abstract member Load : unit -> System.Web.UI.WebControls.WebParts.PersonalizationScope
override this.Load : unit -> System.Web.UI.WebControls.WebParts.PersonalizationScope
Protected Overridable Function Load () As PersonalizationScope

Returns

A PersonalizationScope instance for the parent WebPartManager.

Exceptions

This method is called when personalization is not enabled (Enabled equals false).

-or-

The value of the Page property for the associated WebPartManager is null.

-or-

The value of the Request property on the WebPartManager control's associated Page instance is null.

A provider was explicitly set in either the page markup or the ProviderName property and the provider could not be found.

-or-

The object containing the personalization state data is null.

A problem occurred while loading and deserializing data.

-or-

An error occurred in the definition of a personalization provider in the configuration file.

The underlying personalization providers failed to initialize because a default provider could not be found or because a failure occurred while attempting to initialize a personalization provider.

Remarks

This is the main entry point for initializing personalization information on behalf of the parent WebPartManager control. This method is called during the parent WebPartManager control's OnInit method. Normally, if personalization has been disabled on the parent WebPartManager control, this method will never be called.

During the course of this method, the following initializations occur:

  • A reference to either the default personalization provider, or the custom provider indicated in the WebPartManager page markup or the ProviderName property, is obtained.

  • The provider is called to determine the user capabilities (DetermineUserCapabilities) for the currently executing user.

  • The personalization state for the current page/user/scope combination is loaded from the underlying data store by the provider (LoadPersonalizationState) and stored within the WebPartPersonalization instance.

  • The personalization scope for the current page/user/scope is determined by the provider (DetermineInitialScope). Note that the result of this determination might be different than the value of the InitialScope property.

The scope value returned from this method is used as the value for the Scope property.

Note

An InvalidOperationException exception due to personalization not being enabled will occur only if the Load method is called directly. In the ASP.NET implementation, an internal helper method is actually called to perform the load, and this helper method silently returns if personalization has not been enabled for the page.

Applies to

See also