How to access SharePoint web part properties?
- by shannon.stewart
I have created a feature for SharePoint 2007 that has a web part. I have added a custom property to the web part like so:
[Personalizable(PersonalizationScope.Shared)]
[WebBrowsable(true)]
[Category("My Custom Properties")]
[WebDisplayName("ServiceURL")]
[WebDescription("The URL for the Wcf service")]
public string ServiceURL { get; set; }
Along with this web part, I've added a custom page that the web part will have a link to. I would like to reference the web part property from the custom page, but I don't know where these properties are stored. I've tried to access it using the code below, but both property collections don't have any properties stored.
SPFeaturePropertyCollection spProperties = SPContext.Current.Site.Features[this.FeatureGuid].Properties;
or
SPFeaturePropertyCollection spProperties = SPContext.Current.Site.Features[this.FeatureGuid].Definition.Properties;
My question is how can I get a reference to the web part property from other pages?