0
votes

I create in my sharepoint visual web part custom properties, problem is that after a server restart, the value disappears.

public enum Organ { INST1, INST2 };
public static Organ OrganEnum;
[Category("Custom settings"),
Personalizable(PersonalizationScope.Shared),
WebPartStorage(Storage.Shared),
WebBrowsable(true),
WebDisplayName("Organ"),
WebDescription("Choice Organ")]
public Organ _OrganEnum
{
    get { return OrganEnum; }
    set { OrganEnum = value; }
}

I tried in sharepoint web.config edit this line, but it does not work

<SafeControl Assembly="WebPart, Version=1.0.0.1, Culture=neutral, PublicKeyToken=998d82b12e783432" Namespace="WebPart.Organ" TypeName="*" Safe="True" SafeAgainstScript="True" AllowRemoteDesigner="True" />
1

1 Answers

1
votes

Your property OrganEnum shouldn't be static. That is probably what causes your trouble. Try decaring you property like this:

public Organ OrganEnum{ get; set; }

and skip the

public static Organ OrganEnum; 

altogether.