Export (0) Print
Expand All

WebPartPersonalization.Load Method

Initializes personalization.

Namespace:  System.Web.UI.WebControls.WebParts
Assembly:  System.Web (in System.Web.dll)

protected virtual PersonalizationScope Load()

ExceptionCondition
InvalidOperationException

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.

ProviderException

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.

ArgumentException

A problem occurred while loading and deserializing data.

- or -

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

ConfigurationErrorsException

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.

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.

NoteNote

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.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft