Web Parts are the basic units of sharepoint,its pretty easy to create a custom web part.However,the challenge lies in its customization as per the requirements. I have been busy these days working on the web part customizations, one such feature that fascinates me is the customization of web part properties. Customizing the web part properties includes 2 steps : 1.Set the web part property attributes. 2.Create Property accessors. Now,lets see each one of them in detail 1.Set the web part property attributes – Most of the web part proerty attributes comes from the namespace “System.ComponentModel“ .Here are some of the attributes that we can make use of : Category -It specifies a separate category for the custom properties to be displayed on the property pane. WebBrowsable – Specifies if the property should be visible on the pane or not. We need to set this to “true” to make it availabe to the users. WebDisplayName – Display name for the custom property. WebDescription – Description for the custom property. We can have these attributes defined something like this [Category(“Name”),Personalizable(PersonalizationScope.Shared), WebBrowsable (true),WebDisplayName(“UserName for Output”),WebDescription(“Enter Ur name for Output”)] 2.Create property accessors – Web Part requires the appropriate get and set accessors methods. public string DisplayName { get { return Name; } set { Name = value; } } Once we are done with these steps,we should be getting our custom property in the property pane as shown below |
Good…
Good…