ControlCollection.Owner 속성

정의

ControlCollection 개체가 들어 있는 ASP.NET 서버 컨트롤을 가져옵니다.

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

속성 값

Control

Control이 속한 ControlCollection입니다.

예제

다음 코드 예제는 사용자 지정 ControlCollection 재정의 하는 클래스를 ControlCollection 메시지를 작성 하는 방법 (의 이름을 포함 하는 Owner 속성) 컬렉션의 인스턴스를 만들 때 추적 로그에 있습니다. 이 예제가 작동 하려면 애플리케이션 또는 페이지에 대 한 추적을 활성화 해야 합니다.

// 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

적용 대상

추가 정보