Delegate Controls in SharePoint 2010 and 2013
For More Information on SharePoint 2013 Delegate Controls
http://zimmergren.net/technical/sp-2013-some-new-delegatecontrol-additions-to-the-sharepoint-2013-master-pages
Delegate Controls
The Purpose of Delegate Controls is to Achieve the Customized functionality inside a master page without touching the Master Page
Generally, Whenever we Create Master Page in SharePoint it comes up with Some out of box delegate Controls .
These Delegate controls has got some default functionality assigned by Microsoft guys
. So in case if we want to Override (means replacing the Default functionality with New Functionality ) the delgate Controls . through Visual Studio we can do this activity.
The below Delegate Controls are by default available in Master Page .
- GlobalNavigation.
- SmallSearchInputBox.
- QuickLaunchDataSource.
- AdditionalPageHead.
1. Create new Empty Sharepoint Project
2. Create a new User Control and add some stuff in it.
3. Add Empty Elemnt.xml file
Empty Elemnt.xml : Inside the Element.XML File we are Intergrating the UserControl with Delgate Control in SharePoint Matser Page .
4. Deploy and See in Master Page
Not only we overide the Exsiting Delegate Controls we can also create new Delegate Controls .
- Sequence numbers. These numbers determine which control will be loaded in a delegate control. A delegate control can only have one control, unless AllowMultipleControls is set to true (See the second note just below). The control with the lowest sequence number will be the one rendered in the page.
- The AllowMultipleControls gives the developer the option to load several controls one after the other. This means that a custom delegate control will not replace an existing one and the order will be determined by the sequence number.
AdditionalPageHead
<SharePoint:DelegateControl runat="server" ControlId="AdditionalPageHead" AllowMultipleControls="true"/>
This delegate control allows the developer to add multiple html head lines. They will be rendered together with the ones SharePoint adds already there out of the box. For instance, we could load different .js libraries without modifying the existing MasterPage, or even build some logic behind our specific delegate control to load a JS library based on the logged user credentials.
GlobalNavigation
<SharePoint:DelegateControl runat="server" ControlId="GlobalNavigation"/>
This delegate control is used to add content at the top of the page, even on top of the “Site Actions” or “Welcome ID” Controls. SharePoint out of the box is using this delegate control to add some custom links, such as “My Network”, “My Content” and “My Profile” when we access our “My Site”.
GlobalSiteLink0
<SharePoint:DelegateControl runat="server" ID="GlobalDelegate0" ControlId="GlobalSiteLink0" />
This delegate control is used by SharePoint to place the Variations Menu. If we had multiple languages enabled in our site, we would be able to choose the appropriate language leveraged by the control “VariationsLabelMenu.ascx” placed within this delegate control.
GlobalSiteLink2
<SharePoint:DelegateControl ControlId="GlobalSiteLink2" ID="GlobalDelegate2" Scope="Farm" runat="server" />
SharePoint will use this delegate control to place a Social Delegate Control called “socialdata.ascx”. This control is the one in charge to render the links to “My Site” and “My Profile” when we expand the Welcome ID control.
PublishingConsole
<SharePoint:DelegateControl runat="server" ControlId="PublishingConsole" Id="PublishingConsoleDelegate">
This control is the one rendering the dynamic publishing console. We should call it Server Ribbon when we are referring to SharePoint 2010. This Server Ribbon is the component that enables the end-user, and content editors, to work with SharePoint as a full WYSIWYG CMS. It renders all buttons, tabs, contextual tabs and contextual tab groups that appear while working with pages, documents or SharePoint content in general. It is not necessary now, with SharePoint 2010, to tweak this control in order to add buttons and/or tabs, you can use some other supported way to add them to the Ribbon (it could be another topic to blog about in the future).
GlobalSiteLink3
<SharePoint:DelegateControl ControlId="GlobalSiteLink3" Scope="Farm" runat="server"/>
Renders two image links that are used to tag the current Page and open the SocialDataFrame.aspx page, allowing the user to manage the social tags and notes that are associated with the current Page.
SmallSearchInputBox
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" Version="4"/>
This delegate control renders the small search box. This search box control leverages the search functionality as it’s been configured in Site Collection Administration, such as whether to show the search scopes etc… you could build your own Search Input Box component and replace it wherever your feature is activated.
TopNavigationDataSource & QuickLaunchDataSource
<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
<SharePoint:DelegateControl runat="server" ControlId="QuickLaunchDataSource">
I covered these two delegate controls with my post about custom Top and QuickLaunch menus. Just to give you an intro to this subject I could say that with these delegate controls we can override the datasources that feed the top menu and quicklaunch menu. Therefore you can customize the links that appear dynamically or show/hide links based on any business requirement.
TreeViewAndDataSource
<SharePoint:DelegateControl runat="server" ControlId="TreeViewAndDataSource">
This delegate control wraps together a DataSource and a TreeView control. This control is rendering the content provided by the datasource. So, as you can see, this is a pretty self-enclosed and neat solution. If you dive a bit deeper into the FEATURES folder within the 14 hive you will see this delegate control is used not only at MasterPage level but also in several application pages, mainly the ones giving you the option to pick up files, such as upload.aspx or Picture Library pages.
SharePoint 2013 Delegate Controls
And now that SharePoint 2013 is available, you can find what's been added to the Delegate Controls collection here... http://www.helpmeonsharepoint.com/2012/07/sharepoint-2013-new-delegate-controls.html
No comments :
Post a Comment