ControlCollection.Owner プロパティ
アセンブリ: System.Web (system.web.dll 内)


次に示すのは、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 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
// 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()); } }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からControlCollection.Owner プロパティを検索する場合は、下記のリンクをクリックしてください。

- ControlCollection.Owner プロパティのページへのリンク