Web Parts are part of the ASP.NET technology and are used extensively in Microsoft SharePoint installations. They are used to display or manipulate content on a SharePoint site by the end user. The changes made can be made visible for all or only for certain users. In addition, settings can be saved and assigned permanently to the user who made them. This allows users to tailor a web page to their own needs without the intervention of the administrator. This feature is called personalization.
For example, Web Parts are used to display SharePoint libraries or lists. For example, if a document library is created in a SharePoint site, it can be displayed multiple times on a SharePoint page by multiple Web Parts, for example, once by date of the last change and hierarchically by the folder structure of the document library. Also the selection of the displayed elements and attributes can be varied between the different Web Parts.
Like most SharePoint elements, Web Parts can be assigned and with separate display and editing rights. These are independent of the rights of the library or list displayed by the Web Part.
While building a Webpart solution in Visual Studio one other way of initializing and loading .js and .css files (also including glyphicons, images etc) while creating a SharePoint WebPart project is to add them in as a SPModule and including them as a Generic html controls or also as the namespace for this class goes as HtmlGenericControl
I will describe the following aspects which can be involved using HtmlGenericControl below :
- Meta Tags
- Script links
- Html tags (if necessary)
Metadata is primarily intended to improve the searchability of the World Wide Web or a single website in SharePoint. In addition, specific instructions for controlling the search engines of search engines can be recorded using metadata. During the early days metadata was used as a secret weapon to be listed as far above as possible in a search engine.
In SharePoint Meta tags are used for optimal retrieval of information for your SharePoint site
Here below is a code which can be easily integrated into webpart ASCX CS file like this with the below code which includes the HtmlGenericControls.
The custom CSS and JS files are included as a SPModule and are referenced using a relative url
Certain Html tags can be included along with giving them a certain ID or Class as below
Conclusion : One can implement html tags by directly introducing them in the ASCX file, which has many custom definition of the required layout, but sometimes the rendering of html elements can interfere with the functionality of the webpart. This method is just another way to introduce html elements into the webpart without editing the ASCX file.