RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


SharePoint's Delegate Control Power : Page 3

Learn about a handy feature that lets you isolate the functionality of one control from another on one or more Web sites.


Extra, Extra HTML
What about situations where you need to wrap the delegate control in some static HTML? Although it's possible to include HTML around the DelegateControl, that approach emits the HTML whether the DelegateControl exists or not. Two attributes—PrefixHtml and SuffixHtml—control the HTML to be emitted before the delegate control and the HTML to be emitted after the delegate control, respectively. This technique allows you to add HTML only when a delegate control exists. You’ll find that the out-of-the-box SharePoint templates do this when they want to emit a <div>tag with a class around content when it appears.

The Scopeattribute is another delegate control attribute. While it may appear to be seemingly useless, it does allow you to filter delegate controls to those deployed by features of the same scope. This attribute allows you to make certain delegate controls work throughout the entire farm, not just within a single web site or web application. Farm features are activated automatically when they are installed, allowing the template designer to create points that must be applied everywhere.

The out-of-the-box default.masterdefines these delegate controls for you to override:

  • AdditionalPageHead
  • GlobalSiteLink0
  • GlobalSiteLink1
  • GlobalSiteLink2
  • SmallSearchInputBox
  • TopNavigationDataSource
  • PublishingConsole
  • QuickLaunchDataSource

Of these, only the AdditionalPageHead is set to allow multiple controls. Notice that PublishingConsoleis defined, which is true even if MOSS isn't installed.

Delegate controls are an important option for creating solutions that can be mixed and matched with other options. The ability to isolate one feature on a site from another feature can be an important tool in the SharePoint developer's toolbox.

Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date