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)
Available in Sandboxed Solutions: No

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

How to: Create a Custom Field Type

Custom Field Types

Walkthrough: Creating a Custom Field Type