In this post I’ll show how to create a simple (but own) delegate control.
A short intro and links on delegate controls can be found on sharepointoverflow.
Take a look on master page. There are already many delegate controls. The delegate control with id AdditionalPageHead can be used for adding your script or jQuery library.:
<SharePoint:DelegateControl
runat="server"
ControlId="AdditionalPageHead"
AllowMultipleControls="true"/>
You can also override existing controls like searchbox. But what if you want to add some content in the master page where no delegate controls are present. Of course, you can add it directly to the master page. Perhaps not on all webs? You can use placeholders to manage it. But do you want to update all the page layouts?
So the solution is to use delegate controls, for adding multiple pieces of content or overriding using Sequence. In this example I’ll add some new content to the quicklaunch bottom area:
<SharePoint:UIVersionedContent
UIVersion="4" runat="server"
id="PlaceHolderQuickLaunchBottomV4">
<ContentTemplate>
Now we’ll create a brand new delegate control. Just add it after ContentTemplate:
<SharePoint:DelegateControl runat="server"
ControlId="AdditionalQuickLaunchArea"
AllowMultipleControls="true"/>
In your Visual Studio project add a mapped folder for CONTROLTEMPLATES and add a new user control: MyText.

Just write some text in the user control.
Add a new empty element:

Reference to your user control in the elements.xml file:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Control Id="AdditionalQuickLaunchArea"
ControlSrc="~/_CONTROLTEMPLATES/MyText.ascx"
Sequence="1000" />
</Elements>
Now deploy to your site and see the difference:

This is just a simple tutorial which shows how to start developing a custom delegate control, only for demonstration purpose only. No formatting or good solution design have been payed attention.
Here is the original s4-leftpanel section from v4 without v3 ui versioned controls:
<div id="s4-leftpanel" class="s4-notdlg">
<div id="s4-leftpanel-content">
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBarDataSource" runat="server" />
<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat="server" />
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat="server"></asp:ContentPlaceHolder>
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBarTop" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server">
<div class="ms-quicklaunchouter">
<div class="ms-quickLaunch">
<asp:ContentPlaceHolder id="PlaceHolderQuickLaunchTop" runat="server">
</asp:ContentPlaceHolder>
<Sharepoint:SPNavigationManager id="QuickLaunchNavigationManager"
runat="server"
QuickLaunchControlId="QuickLaunchMenu"
ContainedControl="QuickLaunch"
EnableViewState="false"
CssClass="ms-quicklaunch-navmgr">
<div>
<SharePoint:DelegateControl runat="server" ControlId="QuickLaunchDataSource">
<Template_Controls>
<asp:SiteMapDataSource
SiteMapProvider="SPNavigationProvider"
ShowStartingNode="False"
id="QuickLaunchSiteMap"
StartingNodeUrl="sid:1025"
runat="server"/>
</Template_Controls>
</SharePoint:DelegateControl>
<SharePoint:UIVersionedContent UIVersion="4" runat="server">
<ContentTemplate>
<SharePoint:AspMenu
id="V4QuickLaunchMenu"
runat="server"
EnableViewState="false"
DataSourceId="QuickLaunchSiteMap"
UseSimpleRendering="true"
UseSeparateCss="false"
Orientation="Vertical"
StaticDisplayLevels="2"
MaximumDynamicDisplayLevels="0"
SkipLinkText=""
CssClass="s4-ql" />
</ContentTemplate>
</SharePoint:UIVersionedContent>
</div>
</Sharepoint:SPNavigationManager>
<asp:ContentPlaceHolder id="PlaceHolderQuickLaunchBottom" runat="server">
<SharePoint:UIVersionedContent UIVersion="4" runat="server" id="PlaceHolderQuickLaunchBottomV4">
<ContentTemplate>
<ul class="s4-specialNavLinkList">
<li>
<SharePoint:ClusteredSPLinkButton
runat="server"
NavigateUrl="~site/_layouts/recyclebin.aspx"
ImageClass="s4-specialNavIcon"
ImageUrl="/_layouts/images/fgimg.png"
ImageWidth=16
ImageHeight=16
OffsetX=0
OffsetY=428
id="idNavLinkRecycleBin"
Text="<%$Resources:wss,StsDefault_RecycleBin%>"
CssClass="s4-rcycl"
PermissionsString="DeleteListItems" />
</li>
<li>
<SharePoint:ClusteredSPLinkButton
id="idNavLinkViewAllV4"
runat="server"
PermissionsString="ManageLists"
NavigateUrl="~site/_layouts/viewlsts.aspx"
ImageClass="s4-specialNavIcon"
ImageUrl="/_layouts/images/fgimg.png"
ImageWidth=16
ImageHeight=16
OffsetX=0
OffsetY=0
Text="<%$Resources:wss,quiklnch_allcontent_short%>"
accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>"/>
</li>
</ul>
</ContentTemplate>
</SharePoint:UIVersionedContent>
</asp:ContentPlaceHolder>
</div>
</div>
</asp:ContentPlaceHolder>
</div>
</div>
Like this:
Be the first to like this post.
Pingback: Custom PlaceHolder « Sharepoint. Kunskap. Upptäckter på resan.
Pingback: Contact Site Administrator from anywhere in you SharePoint site. « SC Vinod's Blog