I just run this example: http://msdn.microsoft.com/en-us/library/ms470880.aspx

But I dont see what are delegate controls for, I can do this same thing with webparts or visual webparts, so what are the benefits?


Well delegate controls provide you with Content Lightup functionality. So what it means to a developer is he can have the same control to exhibit different based on the scope of the feature.

Delegate controls act as a container for any other custom functionality (e.g. user control). On runtime a delegate control will be replaced by a control that uses its ID at a specific scope (as you might have seen in the msdn article).

After you register your delegate control on your master page you can control which functionality your delegate control renders at what scope or you can choose to leave it unused and it won't be rendered on the page at all.

Hope this helps..


To enhance Viveks answer.

Delegate controls are defined in the master page as place holders for controls. SharePoint uses this extensively. For instance it uses a delegate control to insert the My Site menu, user profile redirection, menus, search boxes etc. The delegate control place holder can define if it allows one or more delegate controls. If configured so that it only can contain one control, you as a developer can create your own delegate ctrl and replace the current one. That is you can replace very much of the OOB functionality.

As Vivek says, the delegate controls can be differently scoped so that one site or site collection might have one delegate ctrls and another one a completley different on at the same place. To get an idea on what delegate controls are available I previously have written a blog post about it: http://www.wictorwilen.se/Post/Useful-Delegate-Controls-in-Windows-SharePoint-Services-30.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.