Pseudo Knowledge Base

Useful stuff I've collected... Enjoy.
posts - 25, comments - 25, trackbacks - 0

My Links

News

Tag Cloud

Archives

Post Categories

SharePoint 2007 Custom Properties

I have recently been working on some web parts for a site hosted on a SharePoint 2007 (aka MOSS 2007).  I was unable to get the custom properties to work.  Paul Stork was kind enough to provide the answer.  Apparently the method declaration changed between SharePoint 2003 and 2007.  The reference that I had found was for the older version.

Old Version (2003)

private const string defaultText = "John";

private string text = defaultText;

Browsable(true),

Category("Test"),

DefaultValue(defaultText),

WebPartStorage(Storage.Shared),

FriendlyName("Text"),

Description("Text Property")]

public string Text

{

    get { return text; }

    set { text = value; }

}

MOSS 2007 custom Properties

 [System.Web.UI.WebControls.WebParts.WebBrowsable(true)
,System.Web.UI.WebControls.WebParts.WebDisplayName("Text Prop Name")
,System.Web.UI.WebControls.WebParts.WebDescription("Text Prop Tooltip")
,System.Web.UI.WebControls.WebParts.Personalizable(  System.Web.UI.WebControls.WebParts.PersonalizationScope.User)
,System.ComponentModel.Category("Todd Parts")
, System.ComponentModel.DefaultValue(DEFAULT_TEXT_PROP)]
public string TextProp
{
  get { return _textProp; }
  set { _textProp = value; }
}

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted on Monday, November 03, 2008 10:46 PM | Filed Under [ SharePoint ]

Feedback

Gravatar

# re: SharePoint 2007 Custom Properties

Thank you so much man for this post !! I don't believe I have been searching like crazy and I couldn't find anything to solve my problem. I thought there was something wrong in the code itself .. but thanks you just made my day !!
6/8/2009 1:23 AM | Mohammad Ghassan
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: