Create and implement delegate controls

A delegate control is a SharePoint control which allows you to show different content in a predefined master page area on different sites, webs, etc.

SharePoint comes with a set of predefined delegate controls, but of course you can add your own ones to the master page if the existing ones don’t satisfy your needs.

If you’d like to override a delegate control then you’ll need a feature to do so. In your feature you need to add a Control element to your XML, like the following:

<Control Id=”IdOfTheDelegateControl” Sequence=”100” ControlSrc=”/_ControlTemplates/Mycontrol.ascx” />

Or you can specify a control from an assembly, like so:

<Control Id=”IdOfTheDelegateControl” Sequence=”100” ControlClass=”MyControl” ControlAssembly=”Assembly.MyControls” />

You can also set properties on your controls in the XML definition:

<Property Name=”MyProp”>Value</Property>

There’s one property I haven’t mentioned yet, the AllowMultipleControls. As its name suggests it renders all the controls specified in different levels in the delegate control, ordering by the Sequence property. If you don’t set it (the default is false) then the override with the lowest Sequence number will be rendered on the page.

You can read more about delegate controls at MSDN.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s