In my properties I have a properties called Kompania
and it is a dropdown properties. How can I retrieve the current properties for Kompania
Please help me!
In my properties I have a properties called Kompania
and it is a dropdown properties. How can I retrieve the current properties for Kompania
Please help me!
To get the properties of a visual WebPart programmatically, you can refer to the following code for the WebPart at this article.
public enum CityEnum { Manila, Berlin, Auckland, Zurich };
public static CityEnum SampleDropDown;
[Category("Extended Settings"),
Personalizable(PersonalizationScope.Shared),
WebBrowsable(true),
WebDisplayName("Sample Drop Down"),
WebDescription("Please Choose a Sample DropDown")]
public CityEnum _SampleDropDown
{
get { return SampleDropDown; }
set { SampleDropDown = value; }
}
then on Page_Load() method use this line
Label1.Text = yourclass._SampleDropDown;
Add the following code below class definition.
[WebBrowsable(true),
WebDisplayName("Project ID"),
WebDescription("Enter Project Number"),
Personalizable(PersonalizationScope.Shared),
Category("Project Settings")]
public string ProjectID { get; set; }
To get the property value in code, you should use the “ProjectID” variable that defined as
public string ProjectID { get; set; }
You can also check detail steps at Create Custom WebPart Property for SharePoint Visual WebPart