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 webpart with a personalizable property scoped to the user level.

    public class TestWebpart : WebPart
        static int _backColor = 1;
        public int backColor
            get { return _backColor; }
            set { _backColor = value; }
        // Visual Studio might automatically update this path when you change the Visual Web Part project item.
        private const string _ascxPath = @"~/_CONTROLTEMPLATES/SharepointTextEditor/TestWebpart/TestWebpartUserControl.ascx";

        protected override void CreateChildControls()
            TestWebpartUserControl control = Page.LoadControl(_ascxPath) as TestWebpartUserControl;
            control.colorIndex = this.backColor;

In the web part user control codebehind I style some controls based on the currently selected color:

public int colorIndex { get; set; }

     protected void Page_Load(object sender, EventArgs e)
                switch (color)
                    case x: div1.InnerHtml = blueStyle;
                             colorIndex = x;
                             new TestWebpart().backColor = 3;
                    case y: div1.InnerHtml = goldStyle;
                             colorIndex = y;
                              new TestWebpart().backColor = 3;

The problem is that the property changes aren't persisted on an user base. It do save the status but the same for all the users. If I make a change made for one user, all the other users see the change as well.

Do I miss something to make it work correctly?

share|improve this question
Did u actually used the "Personalize this page" link when changing properties or the regular EDIT? – Marius Constantinescu - MVP Apr 26 '12 at 12:22
none of that, i created buttons that role is to redirect on the same page with querry string that change the color – Hassan Apr 26 '12 at 12:50
i am also searching for same solution. Do you have any results? – Evgeny Dec 10 '12 at 15:03

Web Part properties with PersonalizationScope=PersonalizationScope.User have the possiblity of storing that setting for individual users as well as for shared.

BUT the individual value is only set when editing the web part after selecting Personalize this page and the indivual value is only used when the page containing the web part is in Personal view.

Note that Wiki pages (and Wiki page libraries) do not support personal view, so you have to create a "Web Part Page" in some document library.

share|improve this answer
and how could that be done by code problematically ? coz i just want the user the click on a color image – Hassan Apr 27 '12 at 7:20

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.