Share via


DelegateControl Class

A generic control that is able to render an ASP.NET control. Delegate controls make their child candidate controls pluggable and replaceable.

Inheritance Hierarchy

System.Object
  System.Web.UI.Control
    Microsoft.SharePoint.WebControls.SPControl
      Microsoft.SharePoint.WebControls.DelegateControl

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class DelegateControl _
    Inherits SPControl
'Usage
Dim instance As DelegateControl
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class DelegateControl : SPControl

Remarks

By declaring a control as an element in a Feature and giving it a priority through the Sequence attribute of the Control element, SharePoint Foundation selects the declared control candidate and instantiates it as a child of the delegate control. At run time, this delegate control accepts the union of control elements declared at the server farm, Web application, site collection, and Web site levels. The control that has the lowest sequence number is added to the control tree through the DelegateControl.

Delegate controls for which the AllowMultipleControls property equals true can host more than one child control. If there are multiple delegate control candidates, they are all added as children at runtime in the order specified by the Sequence attribute. For example, by default the AllowMultipleControls property is used in the AdditionalPageHead delegate control to allow multiple child controls to be added to any page that contains the delegate control.

Note

Members of the DelegateControl class are only intended for use by ASP.NET and are not meant to be called directly from code.

For more information about the delegate control Feature, see Delegate Control (Control Templatization).

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

DelegateControl Members

Microsoft.SharePoint.WebControls Namespace

Other Resources

How to: Customize a Delegate Control

Delegate Controls

Delegate Control (Control Templatization)