EmptyControlCollection Klasa

Definicja

Zapewnia standardową obsługę ControlCollection kolekcji, która jest zawsze pusta.

public ref class EmptyControlCollection : System::Web::UI::ControlCollection
public class EmptyControlCollection : System.Web.UI.ControlCollection
type EmptyControlCollection = class
    inherit ControlCollection
Public Class EmptyControlCollection
Inherits ControlCollection
Dziedziczenie
EmptyControlCollection

Przykłady


/* File name: emptyControlCollection.cs. */

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

namespace CustomControls
{

  // Defines a simple custom control.
  public class MyCS_EmptyControl : Control
  {
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 
    protected override ControlCollection CreateControlCollection() 
    /*
     * Function Name: CreateControlCollection.
     * Denies the creation of any child control by creating an empty collection.
     * Generates an exception if an attempt to create a child control is made.
     */
     {
       return new EmptyControlCollection(this);
     }
     
     [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 
     protected override void CreateChildControls()
     /*
      * Function Name: CreateChildControls.
      * Populates the child control collection (Controls). 
      * Note: This function will cause an exception because the control does not allow 
      * child controls.
      */
      {
        // Create a literal control to contain the header and add it to the collection.
        LiteralControl text;
        text = new LiteralControl("<h5>Composite Controls</h5>");
        Controls.Add(text);
      }
   }
}

' File name: emptyControlCollection.vb.

Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Collections


Namespace CustomControls 

  Public Class MyVB_EmptyControl 
    Inherits Control
    
    <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
    Protected Overrides Function CreateControlCollection() As ControlCollection
    ' Function Name: CreateControlCollection.
    ' Denies the creation of any child control by creating an empty collection.
    ' Generates an exception if an attempt to create a child control is made.
      Return New EmptyControlCollection(Me)
    End Function 
    
    <System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _  
    Protected Overrides Sub CreateChildControls()
    ' Sub Name: CreateChildControls.
    ' Populates the child control collection (Controls). 
    ' Note: This function will cause an exception because the control does not allow 
    ' child controls.
      Dim text As LiteralControl
      text = New LiteralControl("<h5>Composite Controls</h5>")
      Controls.Add(text)
    End Sub 
  End Class 

End Namespace

Uwagi

Ta klasa jest używana, gdy chcesz zdefiniować kontrolkę niestandardową, która nie zezwala na kontrolki podrzędne.

Konstruktory

EmptyControlCollection(Control)

Inicjuje nowe wystąpienie klasy EmptyControlCollection.

Właściwości

Count

Pobiera liczbę kontrolek serwera w ControlCollection obiekcie dla określonej kontroli serwera ASP.NET.

(Odziedziczone po ControlCollection)
IsReadOnly

Pobiera wartość wskazującą, czy ControlCollection obiekt jest tylko do odczytu.

(Odziedziczone po ControlCollection)
IsSynchronized

Pobiera wartość wskazującą, czy ControlCollection obiekt jest synchronizowany.

(Odziedziczone po ControlCollection)
Item[Int32]

Pobiera odwołanie do kontrolki serwera w określonej lokalizacji indeksu ControlCollection w obiekcie.

(Odziedziczone po ControlCollection)
Owner

Pobiera ASP.NET kontrolę serwera, do której ControlCollection należy obiekt.

(Odziedziczone po ControlCollection)
SyncRoot

Pobiera obiekt, który może służyć do synchronizowania dostępu do kolekcji kontrolek.

(Odziedziczone po ControlCollection)

Metody

Add(Control)

Odrzuca dodanie określonego Control obiektu do kolekcji.

AddAt(Int32, Control)

Odrzuca dodanie określonego Control obiektu do kolekcji w określonej pozycji indeksu.

Clear()

Usuwa wszystkie kontrolki z obiektu bieżącego formantu ControlCollection serwera.

(Odziedziczone po ControlCollection)
Contains(Control)

Określa, czy określona kontrolka serwera znajduje się w obiekcie nadrzędnej kontrolki ControlCollection serwera.

(Odziedziczone po ControlCollection)
CopyTo(Array, Int32)

Kopiuje kontrolki podrzędne przechowywane w ControlCollection obiekcie do Array obiektu, począwszy od określonej lokalizacji indeksu w obiekcie Array.

(Odziedziczone po ControlCollection)
Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetEnumerator()

Pobiera moduł wyliczający, który może iterować przez ControlCollection obiekt.

(Odziedziczone po ControlCollection)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
IndexOf(Control)

Pobiera indeks określonego Control obiektu w kolekcji.

(Odziedziczone po ControlCollection)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
Remove(Control)

Usuwa określoną kontrolkę serwera z obiektu nadrzędnego formantu ControlCollection serwera.

(Odziedziczone po ControlCollection)
RemoveAt(Int32)

Usuwa kontrolkę podrzędną w określonej lokalizacji indeksu ControlCollection z obiektu.

(Odziedziczone po ControlCollection)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Metody rozszerzania

Cast<TResult>(IEnumerable)

Rzutuje elementy elementu IEnumerable na określony typ.

OfType<TResult>(IEnumerable)

Filtruje elementy elementu IEnumerable na podstawie określonego typu.

AsParallel(IEnumerable)

Umożliwia równoległość zapytania.

AsQueryable(IEnumerable)

Konwertuje element IEnumerable na .IQueryable

Dotyczy