I'm creating a web part using Visual Studio 2008 for SharePoint 2007. If I'm creating the web part from scratch, I typically don't have any properties defined yet in my code.
I've found that it is hard to remember the syntax for a web part property because of all the attributes I need to specify. For example, the Creating a Web Part with Custom Properties tutorial shows how to create a variety of properties:
[Category("Custom Properties")]
[DefaultValue(c_MyStringDefault)]
[WebPartStorage(Storage.Personal)]
[FriendlyNameAttribute("Custom String")]
[Description("Type a string value.")]
[Browsable(true)]
[XmlElement(ElementName="MyString")]
public string MyString
{
get
{
return _myString;
}
set
{
_myString = value;
}
}
Instead of searching for code each time I want to add a property or typing from scratch, is there an easy way to add a web part property to my custom web part?