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've created a new web part in a sandbox solution. This web part has a custom string property called 'PetName'.

I'd expect to be able to set the initial value of this property in the .webpart file. While this works perfectly in a Farm solution, in a Sandbox solution it does not. The field shows in the web part properties on the UI, but it is blank. I am able to persist a value if I enter a value into the field and click OK.

Does anyone have any idea how to manage this? I'm stumped.

Thanks, Dave


namespace MyDumbWebPart.DumbWebPart
    public class DumbWebPart : WebPart
        [WebBrowsable(true), Personalizable(PersonalizationScope.Shared)]
        public string PetName

        protected override void CreateChildControls()


<?xml version="1.0" encoding="utf-8"?>
  <webPart xmlns="">
      <type name="MyDumbWebPart.DumbWebPart.DumbWebPart, $SharePoint.Project.AssemblyFullName$" />
        <property name="Title" type="string">MyDumbWebPart - DumbWebPart</property>
        <property name="Description" type="string">My Web Part</property>
        <property name="PetName" type="string">Fluffy</property>
share|improve this question

Use get;set; as shown below sample:

private static string OverLayText="<b>This is an html</b>";
        [Category("Extended Settings"),
        WebDisplayName("OverLay text"),
        WebDescription("OverLay Text")]
        public string _OverLayText
                return OverLayText;
                OverLayText = value;
share|improve this answer

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.