When we develop visual WebPart in Visual Studio, we may follow some best practices for better management and organization of WebParts. Here are few good practices to follow:
- 1. Group your web parts: Set the group property in the Elements.xml file of WebPart to make sure the webparts comes under a specific group. This will make easier to find the webpart from sharepoint site. The following image shows how to modify group property:
Figure 1: WebPart’s group property in Visual Studio
Setting up the group property will show the webparts under ‘Test Group’ as shown below:
Figure 2: Webparts under Group.
- Organize webparts under folder in Visual Studio: Often we are uses to create webparts in the root folder of the Visual Studio Projects. As the number of webparts grow, the folder starts to increase and navigability/manageability problem comes to light. One solution is to keep all webparts under a different folder. Another option is to keep related items under a particular folder. For example all items for navigation can be kept under a root folder “Navigation”. The following image shows all webparts are kept under ‘webparts’ folder.
Figure 3: Webparts organized under folders
Enter descriptive name and description for your webparts: As soon you create an webpart, enter descriptive name and descrition. To do so open the file with .webpart extension and modify Title and Description property as shown below:
Figure 4: Title and description of an WebPart.