Control.Parent Property

Gets a reference to the server control's parent control in the page control hierarchy.

Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)

virtual property Control^ Parent {
	Control^ get ();
/** @property */
public Control get_Parent ()

public function get Parent () : Control

Not applicable.

Property Value

A reference to the server control's parent control.

Whenever a page is requested, a hierarchy of server controls on that page is built. This property allows you to determine the parent control of the current server control in that hierarchy, and to program against it.

The following example sets a new Control object on a page, myControl1, to the control specified in a FindControl method call. If the call returns a control, the code uses the Parent property to identify the control that contains myControl1. If the parent control exists, the string "The parent of the text box is" is concatenated with the ID property of the parent control and written to the Page. If no parent control is found, the string "Control not found" is written.

No code example is currently available or this language may not be supported.
private void Button1_Click(Object sender, EventArgs myEventArgs)
    // Find control on page.
    Control myControl1 = FindControl("TextBox2");
    if (myControl1  != null) {
        // Get control's parent.
        Control myControl2 = myControl1.get_Parent();
        this.get_Response().Write("Parent of the text box is : " 
            + myControl2.get_ID());
    else {
        this.get_Response().Write("Control not found");

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0