PersonalizationAdministration.GetCountOfState Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a count of the personalization state items in the underlying data store that exist for the specified scope and additional parameters.
Overloads
GetCountOfState(PersonalizationScope, String) |
Returns a count of the personalization state items in the underlying data store that exist for the specified parameters. |
GetCountOfState(PersonalizationScope) |
Returns a count of the personalization state items in the underlying data store that exist for the specified scope. |
GetCountOfState(PersonalizationScope, String)
Returns a count of the personalization state items in the underlying data store that exist for the specified parameters.
public:
static int GetCountOfState(System::Web::UI::WebControls::WebParts::PersonalizationScope scope, System::String ^ pathToMatch);
public static int GetCountOfState (System.Web.UI.WebControls.WebParts.PersonalizationScope scope, string pathToMatch);
static member GetCountOfState : System.Web.UI.WebControls.WebParts.PersonalizationScope * string -> int
Public Shared Function GetCountOfState (scope As PersonalizationScope, pathToMatch As String) As Integer
Parameters
- scope
- PersonalizationScope
The scope of the personalization state items to retrieve.
- pathToMatch
- String
The path to the page with personalization state items to retrieve.
Returns
The number of personalization state items for the specified scope.
Exceptions
The provider for a personalization provider defined in configuration is not of the correct type.
-or-
pathToMatch
, after trimming, is an empty string ("").
-or-
The length of the string of any parameter is greater than 256 characters.
A configuration exception occurred while attempting to create and initialize an instance of one of the configured personalization providers.
-or-
The default personalization provider defined in configuration could not be found.
scope
is not a valid member of the PersonalizationScope enumeration.
The default provider returned a negative number for the count.
Remarks
Use this method to determine the number of personalization state items in the underlying data store for the specified scope and path.
See also
- WebPartPersonalization
- ASP.NET Web Parts Controls
- Web Parts Personalization Overview
- Walkthrough: Implementing Web Parts Personalization with a User Control
- Web Parts Personalization
Applies to
GetCountOfState(PersonalizationScope)
Returns a count of the personalization state items in the underlying data store that exist for the specified scope.
public:
static int GetCountOfState(System::Web::UI::WebControls::WebParts::PersonalizationScope scope);
public static int GetCountOfState (System.Web.UI.WebControls.WebParts.PersonalizationScope scope);
static member GetCountOfState : System.Web.UI.WebControls.WebParts.PersonalizationScope -> int
Public Shared Function GetCountOfState (scope As PersonalizationScope) As Integer
Parameters
- scope
- PersonalizationScope
The scope of the personalization state items to retrieve.
Returns
The number of personalization state items for the specified scope.
Exceptions
scope
is not a valid member of the PersonalizationScope enumeration.
The provider for a personalization provider defined in configuration is not of the correct type.
-or-
The length of the string of any parameter is greater than 256 characters.
A configuration exception occurred while attempting to create and initialize an instance of one of the configured personalization providers.
-or-
The default personalization provider defined in configuration could not be found.
The default provider returned a negative number for the count.
Examples
The following code example demonstrates how to use the GetCountOfState method. The complete example can be found in the PersonalizationAdministration class overview topic.
Label4.Visible = false;
TextBox4.Text = PersonalizationAdministration.GetCountOfState(PersonalizationScope.User).ToString();
Remarks
Use this method to determine the number of personalization state items in the underlying data store for the specified scope. Use the GetCountOfState method to further narrow the count to a particular page.
See also
- WebPartPersonalization
- ASP.NET Web Parts Controls
- Web Parts Personalization Overview
- Walkthrough: Implementing Web Parts Personalization with a User Control
- Web Parts Personalization