How to: Create Personalizable Properties on a Web Parts Control
Updated: April 2009
One of the core features of the Web Parts control set is the ability to personalize controls on a page. This allows the end user to set property values that stay with that user whenever he or she views the page.
Page developers can enable personalization by applying the Personalizable attribute to a public property of a Web Parts control. The control can be a custom control inherited from WebPart, a user control, or any other control you can create a property on, as long as it resides in a WebPartZone zone and there is a WebPartManager control somewhere on the page.
For this procedure to work, you need an ASP.NET Web site that can identify individual users. If you have such a site already configured, you can use that. Otherwise, for details on creating a virtual directory, see How to: Create and Configure Virtual Directories in IIS 5.0 and 6.0.
You will also need a configured personalization provider and database. Web Parts personalization is enabled by default; if you have Microsoft SQL Server Express (SSE) installed, no configuration is needed. SSE is available with Microsoft Visual Studio 2005 as an optional part of the installation, or as a free download from Microsoft.com.
Otherwise, if you are using a full version of SQL Server, see Creating and Configuring the Application Services Database for SQL Server, or for a non-SQL database or storage solution, see Implementing a Membership Provider.
To enable personalization on a control
Place the control to personalize inside a WebPartZone zone on an ASP.NET Web Parts page. The page must contain a WebPartManager control for Web Parts controls to function. For more information, see Walkthrough: Creating a Web Parts Page.
At the top of the code block where the property you want to personalize is defined, add the Personalizable attribute, as shown in the following example.