ControlCollection.Owner Property
Gets the ASP.NET server control to which the ControlCollection object belongs.
[Visual Basic] Protected ReadOnly Property Owner As Control [C#] protected Control Owner {get;} [C++] protected: __property Control* get_Owner(); [JScript] protected function get Owner() : Control;
Property Value
The Control object to which the ControlCollection object belongs.
Example
[Visual Basic] The following code example is a custom ControlCollection class that overrides the ControlCollection to write messages, that includes the name of the Owner property, to the trace log when an instance of the collection is created. You must enable tracing for the page or application for this example to work.
[Visual Basic]
' Create a custom ControlCollection that writes
' information to the Trace log when an instance
' of the collection is created.
Public Class CustomControlCollection
Inherits ControlCollection
Private context As HttpContext
Public Sub New(ByVal owner As Control)
MyBase.New(owner)
context.Trace.Write("The control collection is created.")
' The displays the Name of the control
' that uses this collection when tracing is enabled.
context.Trace.Write("The owner is: " _
& Me.Owner.ToString())
End Sub
End Class
[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
ControlCollection Class | ControlCollection Members | System.Web.UI Namespace | Controls