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


SharePoint's Delegate Control Power

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


ne complaint about Microsoft Windows SharePoint Services (WSS) 2.0 and Microsoft SharePoint Portal Server 2003 was the difficulty in making changes to the environment after it was deployed. Officially, changing a site definition isn't supported after it has been used to create other sites. Of course, that was then.

Now, Windows SharePoint Services 3.0 and Microsoft Office SharePoint Server (MOSS) 2007 offer many ways to make changes to sites after they have been provisioned. The introduction of SharePoint Features (note the capital "F") has opened up an entire world to changing master pages, page layouts, and pages themselves. Further, SharePoint now includes a new technique—delegate controls—that allows for more fine-grained control over partsof the page.

If you think about the entire SharePoint model and using Web Parts, it's all about decoupling the designer from the specific data on the page. The designer of an application defines the framework, including Web Part zones. It does not, however, specify every type of Web Part that can be used or the code that is used to generate the output of the Web Part. Including the main data has been delegated to the Web Parts on the page.

That solution is great for the parts of the web page that you want users to be able to control, but what about regions of the page that you don't necessarily want the users to be able to change? It's possible technically to create locked Web Part zones, but that approach is painful and requires more than a passing knowledge of how Web Parts work. You need a simpler process that allows you to add new functionality to every page on a site without having the hassle of locked Web Part zones and the associated management code that is required.

The challenge, then, is how do you light up functionality for one site and not another. Perhaps even more challenging is lighting up different sets of functionality for different sites. You might, for instance, want to implement one kind of additional security for some sites and not for others. Similarly, you may want to ensure that corporate-wide announcements are included on some pages and not others.

Such situations are where delegate controls come in handy. A delegate controlallows you to light up functionality on a site-by-site basis and provides the scope to add a single control that doesn't take over the entire page. Delegate controls are stand-ins for the actual controls you want to incorporate when you're building a master page or designing a page layout. Instead of adding that specific search functionality, for example, you can add a delegate control. During run time SharePoint swaps out the delegate control with the best control for the matching functionality, which will be discussed in more detail shortly.

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