WebPartPersonalization.HasPersonalizationState Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Returns a value indicating whether the current page and personalization scope have associated personalization data.

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

Public Overridable ReadOnly Property HasPersonalizationState As Boolean

Property Value

Type: System.Boolean

true if the page has personalization data associated with it; otherwise, false.

Exception Condition

There is no personalization provider associated with the WebPartPersonalization instance. This can occur if the property is accessed prior to the completion of the associated WebPartManager control's OnInit method.

- 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.

This is a convenient method for determining whether the current page and scope combination has personalization data associated with it. Internally, the method calls GetCountOfState on the provider to determine whether data exists.

.NET Framework
Available since 2.0
Return to top