In this article, we will see some basic building blocks of web parts in SharePoint.
Web Part
Web Part is a small building block for UI in SharePoint site. You can use it to edit functionality and to customize the User Interface (UI). In SharePoint sites, the web part is used to perform collaboration within site context. Web part is an ASP.NET Server side control. Using it, you can display your content on pages.
There are two types of web parts in SharePoint.
- ASP.NET Web Parts
It uses System.Web.UI.WebControls.WebParts.WebPart base class.
- SharePoint Web Parts
It uses Microsoft.SharePoint.WebPartPages.WebPart base class.
Web Part Infrastructure
In SharePoint, the web part infrastructure contains various components, such as -
- Web Part Page
- Web Part Manager
- Web Part Zones
- Web Part Elements
- Web Part Gallery
These help to build the web part structural blocks. The below image shows Web Part Infrastructure.
Web Part page
It is the type of page which is used to host Web Parts which can display a collection of information from different sources. It displays various types of data, such as lists, site search results, forms, and external data from other sources. Web part pages reside in a library like a Wiki page.
The web part which is managed by the web part zone is a dynamic web part. The web part which is managed by the page and resides outside a zone is called static web part.
A web part page contains various Web part zones in which you can place web parts. Web Part pages are simple to create without the editor needing skills in rich content editing.
Web Part Manager
The WebPartManager is responsible for serializing and deserializing Web Part-related data as well as storing and retrieving it from the content database.
It is responsible for handling the various Web Parts present in the Web part pages. It manages web part connections, Web parts in Web part zones and views. Web part manager is available to all pages including master pages as it is defined in the master page.
Web Part Zones
Web part zones are building components of web parts. It defines areas where your web parts can be added. Web part zones performing together with the Web part Manager to organize Web parts on to the page. Below image shows different zones in Web parts page.
It acts as a stylish mode to handle Web part borders and width properties. Web part zone defines various set of properties that actually you can use it to bring together the layout of web part into your web part zones. Inside the web part zone lock down properties uses for protection level of web parts.
Listed below are the web part zones properties. It can also allow user to upload web parts, add, remove or edit current web parts onto web part page.
- Title: provide name like Header, Footer etc.
- AllowlayoutChange: you can set it true or false
- Allow Personalization: you can set it true or false
- Frame type: It contains values of None, Title Bar and Border, or Title Bar Only.
Web Part Elements
It contains various action parts as shown in below image.
The web part has an option menu at the upper right corner which performs certain actions belongs to web part type such as Minimize, Close, Delete, Edit, Export, connections to other web parts.
Using action menu you can minimize web part also if something goes wrong you can delete it or if you need to modify web part title or description you can use edit web part action.
Web part gallery
In SharePoint, we have different set of galleries which plays various roles to perform, built in functionality in various sites. Let's have a look into Web part gallery. Web part gallery contains various web parts which are available to build in functionality. In Categories, listed are different types of web parts which have their own specific roles and functionality.
Look into the below image showing web part gallery.
Here, you can choose the required web part from categories while selecting it from parts and add it to the web part page. That's about it for web parts.
Happy reading!!