The AdditionalPageHead
control is one of the most commonly used delegate controls by developers to add custom code to the page. Controls registered to the AdditionalPageHead
control are added to the <head>
element of each page and multiple controls may be added, unlike most other delegate controls that only allow one user control.
In this recipe, we will create an ASCX
user control that will add references to a custom stylesheet and custom JavaScript. We will then register the control to be added to the AdditionalPageHead
delegate control. Using an AdditionalPageHead
delegate control allows us to add our custom stylesheet and custom JavaScript to every SharePoint page, regardless of which master page is being used. This is particularly useful when a custom master page is not required and when managing the master pages for sites on a large scale becomes impractical.