ControlCollection(Control) Oluşturucu
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Belirtilen üst sunucu denetimi için sınıfının yeni bir örneğini ControlCollection başlatır.
public:
ControlCollection(System::Web::UI::Control ^ owner);
public ControlCollection (System.Web.UI.Control owner);
new System.Web.UI.ControlCollection : System.Web.UI.Control -> System.Web.UI.ControlCollection
Public Sub New (owner As Control)
- owner
- Control
Denetim koleksiyonunun oluşturulduğu ASP.NET sunucu denetimi.
parametresi ise owner
null
gerçekleşir.
Aşağıdaki kod örneği, koleksiyonun bir örneği oluşturulduğunda izleme günlüğüne ileti (özelliğin Owner adını içeren) yazmak için oluşturucuyu geçersiz kılan özel ControlCollection bir sınıftır. Bu örneğin çalışması için sayfa veya uygulama için izlemeyi etkinleştirmeniz gerekir.
// 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
Ürün | Sürümler |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET geri bildirimi
.NET, açık kaynak bir projedir. Geri bildirim sağlamak için bir bağlantı seçin: