I am currently developing a customized search webpart for a customer and I wanted to move all environment specific variables to the webpart public properties so that they can easily be changed and the same dll can be used in all environments (dev and production). One of the properties was Scope, which defined search scope to use. It was defined in the following way:
private string scope;
[Browsable(true), Category("Settings"),
DefaultValue("Documents"),
WebPartStorage(Storage.Shared),
FriendlyName("Scope"),
Description("Define Scope of search"),
XmlElement(ElementName = "Scope")]
public string Scope
{
get
{
return scope;
}
set
{
scope = value;
}
}
Well, just to be on the safe side, I set the web part property to "Documents", which is also what I had used as default. I was very confused the next time I opened the "Modify Shared Webpart" menu and found that the field was blank! First I thought there was some error in how the property was defined, but after a while I found that it actually blank the field if it is set to the value defined as default (in this case "Documents").
So, if you run into this little "feature", don't be afraid, everything is just as it should be!
Gustaf
No comments:
Post a Comment