Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I would like to manage my WebPart Properties.

I would store an ID -> this id is the id of a configuration for my webpart.

First: How can i Store it?

Second: How can i Find it?

I'm using the renderOption(), the displayEditMode(), displayDesignMode().

share|improve this question
add comment

1 Answer 1

This article from Microsoft describes exactly how to use web part properties: http://msdn.microsoft.com/en-us/library/dd584174(v=office.11).aspx

Basically, you mark (decorate) a c# Property in your code as follow:

[Personalizable(PersonalizationScope.Shared)]
[WebBrowsable(true)]
[System.ComponentModel.Category("MyCategory")]
[WebDisplayName("Display Name")]
[WebDescription("My Description")]

public string MyProperty { set; get; }

Next up, you can access the property directly in your code:

string propertyValue = this.MyProperty;
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.