Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Writing a custom webpart property programmatically

  Asked By: Sampat    Date: May 12    Category: Sharepoint    Views: 2413

Hello

in my webpart I do have this custom property:

[Personalizable(PersonalizationScope.Shared)]
[WebPartStorage(Storage.Shared)]
[WebBrowsable(true)]
public string Names
{
get { return (this.MyNames); }
set { this.MyNames = value; }
}

This property does not appear in the edit pane and that is wanted.
My question is how can I write values into this custom property
programmatically?

Example where I want to store "Bob" into SharePoint so that the
property "Names" will always have the value "Bob":

this.Names = "Bob";

But this does not work. What am I doing wrong?

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Writing a custom webpart property programmatically Or get search suggestion and latest updates.