I've inherited a VB.NET / MOSS 2007 Sharepoint application and have been tasked with adding a new custom Webpart.
I've declared a number of public properties to store configuration data for the webpart, like so:
Public Class CustomWebPart
Inherits WebPart
<Personalizable> _
Public Property PrimaryID() As Int32
Protected Overrides Sub CreateChildControls()
MyBase.CreateChildControls()
Controls.Add(New LiteralControl(PrimaryID.ToString())
End Sub
End Class
This webpart has been added to a Sharepoint page in the standard way, within a WebPartManager etc..
I've created a custom EditorPart, with which I am able to correctly Sync and Apply changes to these configuration values. My custom EditorPart has the following ApplyChanges method:
Public Overrides Function ApplyChanges() As Boolean
Dim part = DirectCast(Me.WebPartToEdit, CustomWebPart)
part.PrimaryID = idSelector.SelectedValue
part.SetPersonalizationDirty()
End Function
After editing and returning to the page, I see it showing the selected value for my property, and correctly rendering the report as specified in CreateChildControls() (simplified here). However, as soon as I refresh the page, my personalized properties return to their default values.
Here's what I've looked into so far:
- My account has administrative permissions
- Webpart is configured for Shared-level personalization (as it should be)
- Personalization (digging into WebPartManager.Personalization) IsEnabled, IsModifiable, but ProviderName = "" and HasPersonalizationState is uninitialized.
- Other custom webparts, with seemingly identical code, store personalized properties just fine.
Anyways - I'm at a loss. Thoughts? Happy to provide more code as required. Thanks!
<Personalizable> _ Public Property PrimaryID() As Int32
, did you try changing to<Personalizable(PersonalizationScope.Shared)> _