ControlCollection.Owner Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the ASP.NET server control to which the ControlCollection object belongs.
protected:
property System::Web::UI::Control ^ Owner { System::Web::UI::Control ^ get(); };
protected System.Web.UI.Control Owner { get; }
member this.Owner : System.Web.UI.Control
Protected ReadOnly Property Owner As Control
Property Value
The Control to which the ControlCollection belongs.
Examples
The following code example is a custom ControlCollection class that overrides the ControlCollection method to write messages (which include 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.
// Create a custom ControlCollection that writes
// information to the Trace log when an instance
// of the collection is created.
[AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)]
public class CustomControlCollection : ControlCollection
{
private HttpContext context;
public CustomControlCollection(Control owner)
: base(owner)
{
HttpContext.Current.Trace.Write("The control collection is created.");
// Display the Name of the control
// that uses this collection when tracing is enabled.
HttpContext.Current.Trace.Write("The owner is: " + this.Owner.ToString());
}
}
' Create a custom ControlCollection that writes
' information to the Trace log when an instance
' of the collection is created.
<AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class CustomControlCollection
Inherits ControlCollection
Private context As HttpContext
Public Sub New(ByVal owner As Control)
MyBase.New(owner)
HttpContext.Current.Trace.Write("The control collection is created.")
' Display the Name of the control
' that uses this collection when tracing is enabled.
HttpContext.Current.Trace.Write("The owner is: " _
& Me.Owner.ToString())
End Sub
End Class
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET