DotNet Development, SharePoint Customizing, Silverlight, MS Infrastructure and other tips and tricks

Personalizable Properties on a Webpart in Sharepoint

Posted by PANVEGA on March 17, 2008

Create Personalizable Properties on a Web Parts Control

Web Parts provide the foundation for both customization and personalization. Depending on the site configuration, users can easily personalize or customize pages in a Windows SharePoint Services site by adding, reconfiguring, and removing Web Parts. Developing custom Web Parts provides an easy and powerful way to extend sites based on Windows SharePoint Services. When you create a custom Web Part that supports customization and personalization, you simply add properties to your Web Part class and apply a few special attributes.
The Web Part infrastructure of Windows SharePoint Services does all the heavy lifting of serializing, storing, and retrieving the data associated with site customization and member personalization.
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.
WebDescription(“Specify the number of rows you want to see on each page.”),
WebDisplayName(“Rows per page”),
public int RowsPerPage {
   get {
      return GridView1.PageSize;
   set {
      GridView1.PageSize =
Every authenticated User can add or modify the public property in the Webpart settings, when he has enough rights to do that. You just add properties to a Web Part class definition and apply attributes such as Personalizable, WebBrowsable, and WebDisplayName. Once you have done this, the Web Part controls take care of storing and retrieving property values that have been customized or personalized.
If you wanna use the same property value for all users chenge to: PersonalizationScope.Shared


More Information about the webpart Properties.

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

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.

Visual Basic Copy Code<Personalizable()>
Property SampleProperty() As String
End Property
C# Copy Code[Personalizable]
Public string SampleProperty

 See Also
Web Parts Personalization Overview
Requirements for Using Web Parts Personalization
Other Resources
ASP.NET Web Parts Controls
Web Parts Personalization


One Response to “Personalizable Properties on a Webpart in Sharepoint”

  1. Murali said

    Web Parts in Sharepoint be moved outside of edit mode using drag & drop

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: