SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a custom webpart in point to set and get a property per user on page. To change the background and save it per user.

I'm using code like this:

 public static string SampleColor=blue;
    [Category("Extended Settings"),
    WebDisplayName("Sample Color"),
    WebDescription("Please Enter a Sample Color")]
    public string _SampleText
        get { return SampleText; }
        { SampleColor = value;

This is the property I need.. I will have 3 color buttons.

How can I use it on the page? How can I change it and have it be saved on the site?

share|improve this question

Create the property as a dropdown box and the Personalization scope should be PersonalizationScope.User. Sample code might look like below.

public enum UserColor
                Blue = Blue,
                Green = Green,
                Yellow = Yellow
            private ItemCount uColor= UserColor.Blue;
            WebDisplayName("Sample Color"),
            WebDescription("Please Enter a Sample Color.")]
            public UserColor ViewColor
                get { return uColor; }
                set { uColor= value; }
share|improve this answer

Develop the code as described by @Deepu. When you add the web part to a WebPart Page (NOT a wiki page) the users have the option of going to the hidden personal menu and select Personalize this Page and then edit the web part. The only properties they can edit in this mode are the User scoped ones and they only modify them in their personalized view
enter image description here

share|improve this answer
thx for the Help , But i dont want thant user to get in the Edit Personalize, i want on color button click to change the color and save the selected..\ – Hassan Apr 19 '12 at 11:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.