Creating Delegate Controls In SharePoint


In this article I am going to brief about Delegate Controls in SharePoint and how it will be useful in our project development. This example will give a good idea on Delegate Controls and it will be useful in most of the development scenarios.

What is Delegate Control

Delegate Control creates a region in the page that will allow to replace the original content with our custom content. This can be handled using SharePoint feature.

In this example I am going to create user control that is going to replace the ‘AdditionalPageHead’ in master page using delegate control.

By this when I am activating my delegate control feature I will inject my custom .js and .css files into master page.

Steps to create Delegate Control:
  1. Create empty SharePoint project in Visual Studio.

    empty sharepoint project

  2. And deploy that as Farm Solution.


  3. Add mapped folder to ‘CONTROL TEMPLATES’ as in the following:



  4. Create user control called RKControl.


  5. Add CSS registration to user control.
    1. <SharePoint:CSSRegistration ID="Cssregistration" name="<%$SPUrl:~Site/siteassets/styles/RKCss.css%>" runat="server" />  
    css control

  6. Create Module called ‘CentralSiteAssets’ in module folder as in the following:


  7. Add required .css file to the module with folder structure.



  8. Add Type GhostableInLibrary to module element.xml file, so that it will place in SharePoint SiteAssets document library.


  9. Add delegate module to the module folder and configure control as in the following code snippet:
    1. <Control id=”additionalPageHead” Sequence=”98” ControlSrc=”~/_CONTROLTEMPLATES/RKControls.ascs” />  

  10. Create new feature in application, it will by default add the CentralSiteAssets module and Delete Control module, if not add manually.


  11. Set Feature default activation to False, so that we can run the feature to test the functionality.


  12. Configure the Site URL to deploy our project.


  13. Deploy the project.

  14. Open site collection feature and you can find our custom feature. Activate the feature.



Open the site collection home page and view the source you can find our custom css file (RK.css) which is deployed using Delegate control.



Hope this article will give good understanding on how we can create delegate control step-by-step. Happy coding!