Share via


TemplateBasedControl.GetParentTemplateBasedControl method

Gets the parent TemplateBasedControl object, if any, of the specified control.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Shared Function GetParentTemplateBasedControl ( _
    control As Control _
) As TemplateBasedControl
'Usage
Dim control As Control
Dim returnValue As TemplateBasedControl

returnValue = TemplateBasedControl.GetParentTemplateBasedControl(control)
public static TemplateBasedControl GetParentTemplateBasedControl(
    Control control
)

Parameters

Return value

Type: Microsoft.SharePoint.WebControls.TemplateBasedControl
A TemplateBasedControl object that is the parent or closest TemplateBasedControl object ancestor of the control parameter.

Remarks

If the immediate parent of the control parameter is not a TemplateBasedControl object, the Microsoft SharePoint Foundation object tree is used to determine the parent, until either a TemplateBasedControl object has been reached or the containing form object is reached (in which case a null reference (Nothing in Visual Basic) is returned).

If control is a null reference (Nothing in Visual Basic), then a null reference (Nothing in Visual Basic) is returned and no exception is thrown.

See also

Reference

TemplateBasedControl class

TemplateBasedControl members

Microsoft.SharePoint.WebControls namespace

Other resources

Patterns of Custom Field Rendering

Custom Field Types

Walkthrough: Creating a Custom Field Type