Tuesday, June 11, 2013

delegate control in sharepoint 2010

SharePoint allows to customize OOTB functionality without the need for modifying the pages that come with SharePoint with mechanism called “delegate controls”.
A delegate control defines a region in an aspx page that allows the content to be replaced with our custom content.  This custom content is created via a SharePoint feature, and when deployed and activated, replaces the standard content at runtime.

For eg.
<SharePoint:DelegateControl runat="server" ControlId="PageHeader">
</SharePoint:DelegateControl>

ControlId attribute - the Feature we create will use this to substitute the real user/server control
                1)      Create control template under 14 hive
                2)      Create module to add control template
a.  <Control Id="PageHeader" Sequence="90" ControlSrc="~/_ControlTemplates/COBPageHeader.ascx" />
</Elements>
3)      Add module to feature
4)      Deploy
5)      Now custom control result should be reflected instead of standard output of PageHeader
6)      Happy Ending J




No comments:

Post a Comment